ITK  4.10.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 >
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 
77  void SetInputImage(ImageType *img)
78  { this->ProcessObject::SetNthInput(0, img); }
79  const ImageType * GetInputImage(void)
80  {
81  return static_cast< ImageType * >
82  ( this->ProcessObject::GetInput(0) );
83  }
85 
87  void SetOutputImage(ImageType *img)
88  {
89  this->ProcessObject::SetNthOutput(0, img);
90  }
91 
93  {
94  return static_cast< ImageType * >
95  ( this->ProcessObject::GetOutput(0) );
96  }
97 
99  void SetEquivalencyTable(EquivalencyTableType *et)
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 
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() );
124  this->ProcessObject::SetNthOutput( 0, img.GetPointer() );
125  }
126 
128  EquivalenceRelabeler(const Self &) {}
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
virtual void SetNumberOfRequiredOutputs(DataObjectPointerArraySizeType _arg)
Image< IdentifierType, TImageDimension > ImageType
virtual void GenerateData() override
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes...
Definition: itkArray.h:30
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override
Make a DataObject of the correct type to used as the specified output.
ObjectType * GetPointer() const
virtual void GenerateInputRequestedRegion() override
Segmenter< Image< ScalarType, TImageDimension > > SegmenterType
virtual void PrintSelf(std::ostream &os, Indent indent) const override
Hash table to manage integral label equivalencies.
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx)
Make a DataObject of the correct type to used as the specified output.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
virtual void GenerateOutputRequestedRegion(DataObject *output) override
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)