ITK  5.0.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< typename TPixelType, unsigned int TDimension >
64 class ITK_TEMPLATE_EXPORT BoundaryResolver:public ProcessObject
65 {
66 public:
72  itkNewMacro(Self);
73  itkTypeMacro(WatershedBoundaryResolver, ProcessObject);
75 
77  static constexpr unsigned int ImageDimension = TDimension;
78 
80  using PixelType = TPixelType;
85 
88  { this->ProcessObject::SetNthInput(0, bd); }
90  { return static_cast< BoundaryType * >( this->GetInput(0) ); }
92 
95  { this->ProcessObject::SetNthInput(1, bd); }
97  { return static_cast< BoundaryType * >( this->GetInput(1) ); }
99 
102  itkSetMacro(Face, unsigned short);
103  itkGetConstMacro(Face, unsigned short);
105 
110  { this->ProcessObject::SetNthOutput( 0, a.GetPointer() ); }
112  {
113  return static_cast< EquivalencyTableType * >
114  ( this->ProcessObject::GetOutput(0) );
115  }
117 
119  void GenerateData() override;
120 
123  using Superclass::MakeOutput;
124  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
125 
126 protected:
128  {
130  static_cast< EquivalencyTable * >( this->MakeOutput(0).GetPointer() );
131 
132  this->SetNumberOfRequiredOutputs(1);
133  this->ProcessObject::SetNthOutput( 0, eq.GetPointer() );
134  }
135 
136  ~BoundaryResolver() override = default;
137  BoundaryResolver(const Self &) {}
138  void operator=(const Self &) {}
139  void PrintSelf(std::ostream & os, Indent indent) const override;
140 
141  unsigned short m_Face{0};
142  void GenerateOutputRequestedRegion(DataObject *output) override;
143 };
144 } // end namespace watershed
145 } // end namespace itk
146 
147 #ifndef ITK_MANUAL_INSTANTIATION
148 #include "itkWatershedBoundaryResolver.hxx"
149 #endif
150 
151 #endif
Light weight base class for most itk classes.
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
ObjectType * GetPointer() const noexcept
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:40
EquivalencyTableType::Pointer GetEquivalencyTable()
void SetEquivalencyTable(EquivalencyTableType::Pointer a)
Hash table to manage integral label equivalencies.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void SetNthInput(DataObjectPointerArraySizeType num, DataObject *input)
virtual void SetNthOutput(DataObjectPointerArraySizeType num, DataObject *output)
SmartPointer< Self > Pointer
Base class for all data objects in ITK.
DataObject * GetOutput(const DataObjectIdentifierType &key)