ITK  4.8.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 Relabeler:
65  public ProcessObject
66 {
67 public:
69  typedef Relabeler Self;
73 
75  itkNewMacro(Self);
76  itkTypeMacro(WatershedRelabeler, ProcessObject);
78 
80  itkStaticConstMacro(ImageDimension, unsigned int, TImageDimension);
81 
83  typedef TScalar ScalarType;
88 
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  virtual void GenerateData() ITK_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  virtual ~Relabeler() {}
147  Relabeler(const Self &) {}
148  void operator=(const Self &) {}
149  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
150 
151  double m_FloodLevel;
152  virtual void GenerateOutputRequestedRegion(DataObject *output) ITK_OVERRIDE;
153 
154  virtual void GenerateInputRequestedRegion() ITK_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.
virtual void GenerateInputRequestedRegion() override
SmartPointer< Self > Pointer
SegmentTree< ScalarType > SegmentTreeType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
void GraftNthOutput(unsigned int idx, ImageType *graft)
SmartPointer< const Self > ConstPointer
void SetInputSegmentTree(SegmentTreeType *et)
void GraftOutput(ImageType *graft)
void SetOutputImage(ImageType *img)
static const unsigned int ImageDimension
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
DataObject::Pointer DataObjectPointer
Segmenter< Image< ScalarType, TImageDimension > > SegmenterType
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override
Make a DataObject of the correct type to used as the specified output.
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.
void SetInputImage(ImageType *img)
SegmentTreeType * GetInputSegmentTree(void)
virtual void GenerateData() override
virtual void GenerateOutputRequestedRegion(DataObject *output) override
Image< IdentifierType, TImageDimension > ImageType
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.
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
Templated n-dimensional image class.
Definition: itkImage.h:75
virtual void PrintSelf(std::ostream &os, Indent indent) const override
DataObject * GetOutput(const DataObjectIdentifierType &key)