ITK  5.2.0
Insight Toolkit
itkWatershedEquivalenceRelabeler.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 {
53 template <typename TScalar, unsigned int TImageDimension>
54 class ITK_TEMPLATE_EXPORT EquivalenceRelabeler : public ProcessObject
55 {
56 public:
57 
59  static constexpr unsigned int ImageDimension = TImageDimension;
60 
65  using ScalarType = TScalar;
69 
73  itkNewMacro(Self);
74  itkTypeMacro(WatershedEquivalenceRelabeler, ProcessObject);
76 
78  void
80  {
81  this->ProcessObject::SetNthInput(0, img);
82  }
83  const ImageType *
85  {
86  return static_cast<ImageType *>(this->ProcessObject::GetInput(0));
87  }
89 
91  void
93  {
94  this->ProcessObject::SetNthOutput(0, img);
95  }
96 
97  typename ImageType::Pointer
99  {
100  return static_cast<ImageType *>(this->ProcessObject::GetOutput(0));
101  }
102 
104  void
106  {
107  this->ProcessObject::SetNthInput(1, et);
108  }
109 
110  EquivalencyTableType::Pointer
112  {
113  return static_cast<EquivalencyTableType *>(this->ProcessObject::GetInput(1));
114  }
115 
117  void
118  GenerateData() override;
119 
122  using Superclass::MakeOutput;
124  MakeOutput(DataObjectPointerArraySizeType idx) override;
125 
126 protected:
128  {
129  typename ImageType::Pointer img = static_cast<ImageType *>(this->MakeOutput(0).GetPointer());
130  this->SetNumberOfRequiredOutputs(1);
131  this->ProcessObject::SetNthOutput(0, img.GetPointer());
132  }
133 
134  ~EquivalenceRelabeler() override = default;
136  void
137  operator=(const Self &)
138  {}
139  void
140  PrintSelf(std::ostream & os, Indent indent) const override;
141 
142  void
143  GenerateOutputRequestedRegion(DataObject * output) override;
144 
145  void
146  GenerateInputRequestedRegion() override;
147 };
148 } // end namespace watershed
149 } // end namespace itk
150 
151 #ifndef ITK_MANUAL_INSTANTIATION
152 # include "itkWatershedEquivalenceRelabeler.hxx"
153 #endif
154 
155 #endif
itk::EquivalencyTable
Hash table to manage integral label equivalencies.
Definition: itkEquivalencyTable.h:44
itk::watershed::EquivalenceRelabeler::operator=
void operator=(const Self &)
Definition: itkWatershedEquivalenceRelabeler.h:137
itk::watershed::EquivalenceRelabeler::GetInputImage
const ImageType * GetInputImage()
Definition: itkWatershedEquivalenceRelabeler.h:84
itk::watershed::EquivalenceRelabeler::GetEquivalencyTable
EquivalencyTableType::Pointer GetEquivalencyTable()
Definition: itkWatershedEquivalenceRelabeler.h:111
itk::ProcessObject::GetOutput
DataObject * GetOutput(const DataObjectIdentifierType &key)
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ProcessObject::DataObjectPointerArraySizeType
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Definition: itkProcessObject.h:193
itk::watershed::EquivalenceRelabeler::SetInputImage
void SetInputImage(ImageType *img)
Definition: itkWatershedEquivalenceRelabeler.h:79
itk::watershed::EquivalenceRelabeler::GetOutputImage
ImageType::Pointer GetOutputImage()
Definition: itkWatershedEquivalenceRelabeler.h:98
itk::watershed::EquivalenceRelabeler::ScalarType
TScalar ScalarType
Definition: itkWatershedEquivalenceRelabeler.h:65
itk::watershed::Segmenter
Definition: itkWatershedSegmenter.h:89
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itkWatershedSegmenter.h
itk::watershed::EquivalenceRelabeler
Definition: itkWatershedEquivalenceRelabeler.h:54
itk::SmartPointer::GetPointer
ObjectType * GetPointer() const noexcept
Definition: itkSmartPointer.h:132
itk::watershed::EquivalenceRelabeler::EquivalenceRelabeler
EquivalenceRelabeler(const Self &)
Definition: itkWatershedEquivalenceRelabeler.h:135
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject::SetNthOutput
virtual void SetNthOutput(DataObjectPointerArraySizeType idx, DataObject *output)
itk::ProcessObject::SetNthInput
virtual void SetNthInput(DataObjectPointerArraySizeType idx, DataObject *input)
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::ProcessObject
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:41
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::watershed::EquivalenceRelabeler::SetEquivalencyTable
void SetEquivalencyTable(EquivalencyTableType *et)
Definition: itkWatershedEquivalenceRelabeler.h:105
itk::watershed::EquivalenceRelabeler::SetOutputImage
void SetOutputImage(ImageType *img)
Definition: itkWatershedEquivalenceRelabeler.h:92
itk::watershed::EquivalenceRelabeler::EquivalenceRelabeler
EquivalenceRelabeler()
Definition: itkWatershedEquivalenceRelabeler.h:127
itk::DataObject::Pointer
SmartPointer< Self > Pointer
Definition: itkDataObject.h:301
itk::ProcessObject::GetInput
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293