ITK  6.0.0
Insight Toolkit
itkWatershedRelabeler.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 itkWatershedRelabeler_h
19 #define itkWatershedRelabeler_h
20 
22 #include "itkWatershedSegmenter.h"
23 
24 namespace itk
25 {
26 namespace watershed
27 {
64 template <typename TScalar, unsigned int TImageDimension>
65 class ITK_TEMPLATE_EXPORT Relabeler : public ProcessObject
66 {
67 public:
68 
70  using Self = Relabeler;
74 
76  itkNewMacro(Self);
77  itkOverrideGetNameOfClassMacro(Relabeler);
81  static constexpr unsigned int ImageDimension = TImageDimension;
82 
84  using ScalarType = TScalar;
89 
92  using Superclass::MakeOutput;
94  MakeOutput(DataObjectPointerArraySizeType idx) override;
95 
97  void
99  {
100  this->ProcessObject::SetNthInput(0, img);
101  }
102 
103  ImageType *
105  {
106  return itkDynamicCastInDebugMode<ImageType *>(this->ProcessObject::GetInput(0));
107  }
108 
110  void
112  {
113  this->ProcessObject::SetNthOutput(0, img);
114  }
115 
116  ImageType *
118  {
119  return itkDynamicCastInDebugMode<ImageType *>(this->ProcessObject::GetOutput(0));
120  }
121 
123  void
125  {
126  this->ProcessObject::SetNthInput(1, et);
127  }
128 
129  SegmentTreeType *
131  {
132  return itkDynamicCastInDebugMode<SegmentTreeType *>(this->ProcessObject::GetInput(1));
133  }
134 
136  void
137  GenerateData() override;
138 
141  itkSetClampMacro(FloodLevel, double, 0.0, 1.0);
142  itkGetConstMacro(FloodLevel, double);
146  void
147  GraftOutput(ImageType * graft);
148 
149  void
150  GraftNthOutput(unsigned int idx, ImageType * graft);
151 
152 protected:
153  Relabeler();
154  ~Relabeler() override = default;
155  Relabeler(const Self &) {}
156  void
157  operator=(const Self &)
158  {}
159  void
160  PrintSelf(std::ostream & os, Indent indent) const override;
161 
162  double m_FloodLevel{ 0.0 };
163  void
164  GenerateOutputRequestedRegion(DataObject * output) override;
165 
166  void
167  GenerateInputRequestedRegion() override;
168 };
169 } // end namespace watershed
170 } // end namespace itk
171 
172 #ifndef ITK_MANUAL_INSTANTIATION
173 # include "itkWatershedRelabeler.hxx"
174 #endif
175 
176 #endif
itk::watershed::Relabeler::GetInputSegmentTree
SegmentTreeType * GetInputSegmentTree()
Definition: itkWatershedRelabeler.h:130
itkWatershedSegmentTree.h
itk::watershed::Relabeler
Definition: itkWatershedRelabeler.h:65
itk::watershed::Relabeler::GetOutputImage
ImageType * GetOutputImage()
Definition: itkWatershedRelabeler.h:117
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::Relabeler::Relabeler
Relabeler(const Self &)
Definition: itkWatershedRelabeler.h:155
itk::watershed::Segmenter
Definition: itkWatershedSegmenter.h:89
itk::watershed::Relabeler::SetInputImage
void SetInputImage(ImageType *img)
Definition: itkWatershedRelabeler.h:98
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itkWatershedSegmenter.h
itk::watershed::Relabeler::operator=
void operator=(const Self &)
Definition: itkWatershedRelabeler.h:157
itk::watershed::Relabeler::GetInputImage
ImageType * GetInputImage()
Definition: itkWatershedRelabeler.h:104
itk::watershed::SegmentTree
Definition: itkWatershedSegmentTree.h:48
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::watershed::Relabeler::SetInputSegmentTree
void SetInputSegmentTree(SegmentTreeType *et)
Definition: itkWatershedRelabeler.h:124
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::watershed::Relabeler< ScalarType, Self::ImageDimension >::ScalarType
ScalarType ScalarType
Definition: itkWatershedRelabeler.h:84
itk::watershed::Relabeler::SetOutputImage
void SetOutputImage(ImageType *img)
Definition: itkWatershedRelabeler.h:111
itk::ProcessObject
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:41
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
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