ITK  4.4.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< class TScalarType, unsigned int TImageDimension >
64 class ITK_EXPORT Relabeler:
65  public ProcessObject
66 {
67 public:
69  typedef Relabeler Self;
73  itkNewMacro(Self);
74  itkTypeMacro(WatershedRelabeler, ProcessObject);
76 
78  itkStaticConstMacro(ImageDimension, unsigned int, TImageDimension);
79 
81  typedef TScalarType ScalarType;
86 
89  using Superclass::MakeOutput;
90  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
91 
93  void SetInputImage(ImageType *img)
94  {
95  this->ProcessObject::SetNthInput(0, img);
96  }
97 
98  ImageType * GetInputImage(void)
99  {
100  return itkDynamicCastInDebugMode< ImageType * >
101  ( this->ProcessObject::GetInput(0) );
102  }
103 
105  void SetOutputImage(ImageType *img)
106  {
107  this->ProcessObject::SetNthOutput(0, img);
108  }
109 
110  ImageType * GetOutputImage(void)
111  {
112  return itkDynamicCastInDebugMode< ImageType * >
113  ( this->ProcessObject::GetOutput(0) );
114  }
115 
117  void SetInputSegmentTree(SegmentTreeType *et)
118  {
119  this->ProcessObject::SetNthInput(1, et);
120  }
121 
122  SegmentTreeType * GetInputSegmentTree(void)
123  {
124  return itkDynamicCastInDebugMode< SegmentTreeType * >
125  ( this->ProcessObject::GetInput(1) );
126  }
127 
129  void GenerateData();
130 
133  itkSetClampMacro(FloodLevel, double, 0.0, 1.0);
134  itkGetConstMacro(FloodLevel, double);
136 
138  void GraftOutput(ImageType *graft);
139 
140  void GraftNthOutput(unsigned int idx, ImageType *graft);
141 
142 protected:
143  Relabeler();
144  virtual ~Relabeler() {}
145  Relabeler(const Self &) {}
146  void operator=(const Self &) {}
147  void PrintSelf(std::ostream & os, Indent indent) const;
148 
149  double m_FloodLevel;
150  void GenerateOutputRequestedRegion(DataObject *output);
151 
152  void GenerateInputRequestedRegion();
153 };
154 } // end namespace watershed
155 } // end namespace itk
156 
157 #ifndef ITK_MANUAL_INSTANTIATION
158 #include "itkWatershedRelabeler.hxx"
159 #endif
160 
161 #endif
162