ITK  4.13.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  itkStaticConstMacro(ImageDimension, unsigned int, TImageDimension);
59 
64  typedef TScalar ScalarType;
68 
72  itkNewMacro(Self);
73  itkTypeMacro(WatershedEquivalenceRelabeler, ProcessObject);
75 
78  { this->ProcessObject::SetNthInput(0, img); }
79  const ImageType * GetInputImage(void)
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  virtual void GenerateData() ITK_OVERRIDE;
112 
115  using Superclass::MakeOutput;
116  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_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  virtual ~EquivalenceRelabeler() ITK_OVERRIDE {}
129  void operator=(const Self &) {}
130  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
131 
132  virtual void GenerateOutputRequestedRegion(DataObject *output) ITK_OVERRIDE;
133 
134  virtual void GenerateInputRequestedRegion() ITK_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.
Image< IdentifierType, TImageDimension > ImageType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
ObjectType * GetPointer() const
Segmenter< Image< ScalarType, TImageDimension > > SegmenterType
Hash table to manage integral label equivalencies.
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
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)
Base class for all data objects in ITK.
Templated n-dimensional image class.
Definition: itkImage.h:75
DataObject * GetOutput(const DataObjectIdentifierType &key)