ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkWatershedEquivalenceRelabeler.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 itkWatershedEquivalenceRelabeler_h
19 #define itkWatershedEquivalenceRelabeler_h
20 
21 #include "itkWatershedSegmenter.h"
22 
23 namespace itk
24 {
25 namespace watershed
26 {
52 template< typename TScalar, unsigned int TImageDimension >
53 class ITK_TEMPLATE_EXPORT EquivalenceRelabeler:
54  public ProcessObject
55 {
56 public:
58  static constexpr unsigned int ImageDimension = TImageDimension;
59 
64  using ScalarType = TScalar;
68 
72  itkNewMacro(Self);
73  itkTypeMacro(WatershedEquivalenceRelabeler, ProcessObject);
75 
78  { this->ProcessObject::SetNthInput(0, img); }
80  {
81  return static_cast< ImageType * >
82  ( this->ProcessObject::GetInput(0) );
83  }
85 
88  {
89  this->ProcessObject::SetNthOutput(0, img);
90  }
91 
93  {
94  return static_cast< ImageType * >
95  ( this->ProcessObject::GetOutput(0) );
96  }
97 
100  {
101  this->ProcessObject::SetNthInput(1, et);
102  }
103 
105  {
106  return static_cast< EquivalencyTableType * >
107  ( this->ProcessObject::GetInput(1) );
108  }
109 
111  void GenerateData() override;
112 
115  using Superclass::MakeOutput;
116  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
117 
118 protected:
120  {
121  typename ImageType::Pointer img =
122  static_cast< ImageType * >( this->MakeOutput(0).GetPointer() );
123  this->SetNumberOfRequiredOutputs(1);
124  this->ProcessObject::SetNthOutput( 0, img.GetPointer() );
125  }
126 
127  ~EquivalenceRelabeler() override = default;
129  void operator=(const Self &) {}
130  void PrintSelf(std::ostream & os, Indent indent) const override;
131 
132  void GenerateOutputRequestedRegion(DataObject *output) override;
133 
134  void GenerateInputRequestedRegion() override;
135 };
136 } // end namespace watershed
137 } // end namespace itk
138 
139 #ifndef ITK_MANUAL_INSTANTIATION
140 #include "itkWatershedEquivalenceRelabeler.hxx"
141 #endif
142 
143 #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
Hash table to manage integral label equivalencies.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
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.
Templated n-dimensional image class.
Definition: itkImage.h:75
DataObject * GetOutput(const DataObjectIdentifierType &key)