ITK  6.0.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  * https://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  ITK_DISALLOW_COPY_AND_MOVE(EquivalenceRelabeler);
58 
60  static constexpr unsigned int ImageDimension = TImageDimension;
61 
66  using ScalarType = TScalar;
70 
74  itkNewMacro(Self);
75  itkOverrideGetNameOfClassMacro(EquivalenceRelabeler);
79  void
81  {
82  this->ProcessObject::SetNthInput(0, img);
83  }
84  const ImageType *
86  {
87  return static_cast<ImageType *>(this->ProcessObject::GetInput(0));
88  }
92  void
94  {
95  this->ProcessObject::SetNthOutput(0, img);
96  }
97 
98  typename ImageType::Pointer
100  {
101  return static_cast<ImageType *>(this->ProcessObject::GetOutput(0));
102  }
103 
105  void
107  {
108  this->ProcessObject::SetNthInput(1, et);
109  }
110 
113  {
114  return static_cast<EquivalencyTableType *>(this->ProcessObject::GetInput(1));
115  }
116 
118  void
119  GenerateData() override;
120 
123  using Superclass::MakeOutput;
125  MakeOutput(DataObjectPointerArraySizeType idx) override;
126 
127 protected:
129  {
130  const typename ImageType::Pointer img = static_cast<ImageType *>(this->MakeOutput(0).GetPointer());
131  this->SetNumberOfRequiredOutputs(1);
132  this->ProcessObject::SetNthOutput(0, img.GetPointer());
133  }
134 
135  ~EquivalenceRelabeler() override = default;
136 
137  void
138  PrintSelf(std::ostream & os, Indent indent) const override;
139 
140  void
141  GenerateOutputRequestedRegion(DataObject * output) override;
142 
143  void
144  GenerateInputRequestedRegion() override;
145 };
146 } // end namespace watershed
147 } // end namespace itk
148 
149 #ifndef ITK_MANUAL_INSTANTIATION
150 # include "itkWatershedEquivalenceRelabeler.hxx"
151 #endif
152 
153 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::EquivalencyTable
Hash table to manage integral label equivalencies.
Definition: itkEquivalencyTable.h:44
itk::watershed::EquivalenceRelabeler::GetInputImage
const ImageType * GetInputImage()
Definition: itkWatershedEquivalenceRelabeler.h:85
itk::watershed::EquivalenceRelabeler::GetEquivalencyTable
EquivalencyTableType::Pointer GetEquivalencyTable()
Definition: itkWatershedEquivalenceRelabeler.h:112
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:194
itk::watershed::EquivalenceRelabeler::SetInputImage
void SetInputImage(ImageType *img)
Definition: itkWatershedEquivalenceRelabeler.h:80
itk::watershed::EquivalenceRelabeler::GetOutputImage
ImageType::Pointer GetOutputImage()
Definition: itkWatershedEquivalenceRelabeler.h:99
itk::watershed::EquivalenceRelabeler::ScalarType
TScalar ScalarType
Definition: itkWatershedEquivalenceRelabeler.h:66
itk::watershed::Segmenter
Definition: itkWatershedSegmenter.h:89
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkWatershedSegmenter.h
itk::watershed::EquivalenceRelabeler
Definition: itkWatershedEquivalenceRelabeler.h:54
itk::SmartPointer::GetPointer
ObjectType * GetPointer() const noexcept
Definition: itkSmartPointer.h:144
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
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:139
itk::ProcessObject
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:41
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::watershed::EquivalenceRelabeler::SetEquivalencyTable
void SetEquivalencyTable(EquivalencyTableType *et)
Definition: itkWatershedEquivalenceRelabeler.h:106
itk::watershed::EquivalenceRelabeler::SetOutputImage
void SetOutputImage(ImageType *img)
Definition: itkWatershedEquivalenceRelabeler.h:93
itk::watershed::EquivalenceRelabeler::EquivalenceRelabeler
EquivalenceRelabeler()
Definition: itkWatershedEquivalenceRelabeler.h:128
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