ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkWatershedRelabeler.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 itkWatershedRelabeler_h
19 #define itkWatershedRelabeler_h
20 
22 #include "itkWatershedSegmenter.h"
23 
24 namespace itk
25 {
26 namespace watershed
27 {
63 template< typename TScalar, unsigned int TImageDimension >
64 class ITK_TEMPLATE_EXPORT Relabeler:
65  public ProcessObject
66 {
67 public:
69  using Self = Relabeler;
73 
75  itkNewMacro(Self);
76  itkTypeMacro(WatershedRelabeler, ProcessObject);
78 
80  static constexpr unsigned int ImageDimension = TImageDimension;
81 
83  using ScalarType = TScalar;
88 
91  using Superclass::MakeOutput;
92  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
93 
96  {
97  this->ProcessObject::SetNthInput(0, img);
98  }
99 
101  {
102  return itkDynamicCastInDebugMode< ImageType * >
103  ( this->ProcessObject::GetInput(0) );
104  }
105 
108  {
109  this->ProcessObject::SetNthOutput(0, img);
110  }
111 
113  {
114  return itkDynamicCastInDebugMode< ImageType * >
115  ( this->ProcessObject::GetOutput(0) );
116  }
117 
120  {
121  this->ProcessObject::SetNthInput(1, et);
122  }
123 
125  {
126  return itkDynamicCastInDebugMode< SegmentTreeType * >
127  ( this->ProcessObject::GetInput(1) );
128  }
129 
131  void GenerateData() override;
132 
135  itkSetClampMacro(FloodLevel, double, 0.0, 1.0);
136  itkGetConstMacro(FloodLevel, double);
138 
140  void GraftOutput(ImageType *graft);
141 
142  void GraftNthOutput(unsigned int idx, ImageType *graft);
143 
144 protected:
145  Relabeler();
146  ~Relabeler() override = default;
147  Relabeler(const Self &) {}
148  void operator=(const Self &) {}
149  void PrintSelf(std::ostream & os, Indent indent) const override;
150 
151  double m_FloodLevel{0.0};
152  void GenerateOutputRequestedRegion(DataObject *output) override;
153 
154  void GenerateInputRequestedRegion() override;
155 };
156 } // end namespace watershed
157 } // end namespace itk
158 
159 #ifndef ITK_MANUAL_INSTANTIATION
160 #include "itkWatershedRelabeler.hxx"
161 #endif
162 
163 #endif
Light weight base class for most itk classes.
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
void SetInputSegmentTree(SegmentTreeType *et)
void SetOutputImage(ImageType *img)
class ITK_FORWARD_EXPORT ProcessObject
Definition: itkDataObject.h:40
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
void SetInputImage(ImageType *img)
SegmentTreeType * GetInputSegmentTree()
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)