ITK  4.12.0
Insight Segmentation and Registration Toolkit
itkMorphologicalWatershedFromMarkersImageFilter.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 itkMorphologicalWatershedFromMarkersImageFilter_h
19 #define itkMorphologicalWatershedFromMarkersImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
22 
23 namespace itk
24 {
80 template< typename TInputImage, typename TLabelImage >
82  public ImageToImageFilter< TInputImage, TLabelImage >
83 {
84 public:
90 
92  typedef TInputImage InputImageType;
93  typedef TLabelImage LabelImageType;
96  typedef typename InputImageType::RegionType InputImageRegionType;
97  typedef typename InputImageType::PixelType InputImagePixelType;
100  typedef typename LabelImageType::RegionType LabelImageRegionType;
101  typedef typename LabelImageType::PixelType LabelImagePixelType;
102 
103  typedef typename LabelImageType::IndexType IndexType;
104 
106  itkStaticConstMacro(ImageDimension, unsigned int,
107  TInputImage::ImageDimension);
108 
110  itkNewMacro(Self);
111 
114 
116  void SetMarkerImage(const TLabelImage *input)
117  {
118  // Process object is not const-correct so the const casting is required.
119  this->SetNthInput( 1, const_cast< TLabelImage * >( input ) );
120  }
121 
124  {
125  return itkDynamicCastInDebugMode< LabelImageType * >
126  (const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
127  }
128 
130  void SetInput1(const TInputImage *input)
131  {
132  this->SetInput(input);
133  }
134 
136  void SetInput2(const TLabelImage *input)
137  {
138  this->SetMarkerImage(input);
139  }
140 
147  itkSetMacro(FullyConnected, bool);
148  itkGetConstReferenceMacro(FullyConnected, bool);
149  itkBooleanMacro(FullyConnected);
151 
157  itkSetMacro(MarkWatershedLine, bool);
158  itkGetConstReferenceMacro(MarkWatershedLine, bool);
159  itkBooleanMacro(MarkWatershedLine);
161 
162 protected:
165  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
166 
170  void GenerateInputRequestedRegion() ITK_OVERRIDE;
171 
175  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) ITK_OVERRIDE;
176 
178  void GenerateData() ITK_OVERRIDE;
179 
180 private:
181  ITK_DISALLOW_COPY_AND_ASSIGN(MorphologicalWatershedFromMarkersImageFilter);
182 
183  bool m_FullyConnected;
184 
185  bool m_MarkWatershedLine;
186 }; // end of class
187 } // end namespace itk
188 
189 #ifndef ITK_MANUAL_INSTANTIATION
190 #include "itkMorphologicalWatershedFromMarkersImageFilter.hxx"
191 #endif
192 
193 #endif
virtual void PrintSelf(std::ostream &os, Indent indent) const override
Light weight base class for most itk classes.
SmartPointer< Self > Pointer
SmartPointer< const Self > ConstPointer
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Base class for all data objects in ITK.
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49