ITK  4.2.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< class TScalarType, unsigned int TImageDimension >
53 class ITK_EXPORT EquivalenceRelabeler:
54  public ProcessObject
55 {
56 public:
58  itkStaticConstMacro(ImageDimension, unsigned int, TImageDimension);
59 
64  typedef TScalarType 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 
92  typename ImageType::Pointer GetOutputImage()
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 
104  EquivalencyTableType::Pointer GetEquivalencyTable()
105  {
106  return static_cast< EquivalencyTableType * >
107  ( this->ProcessObject::GetInput(1) );
108  }
109 
111  void GenerateData();
112 
115  using Superclass::MakeOutput;
116  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
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 
129  void operator=(const Self &) {}
130  void PrintSelf(std::ostream & os, Indent indent) const;
131 
132  void GenerateOutputRequestedRegion(DataObject *output);
133 
134  void GenerateInputRequestedRegion();
135 };
136 } // end namespace watershed
137 } // end namespace itk
138 
139 #ifndef ITK_MANUAL_INSTANTIATION
140 #include "itkWatershedEquivalenceRelabeler.hxx"
141 #endif
142 
143 #endif
144