ITK  5.0.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:
85  ITK_DISALLOW_COPY_AND_ASSIGN(MorphologicalWatershedFromMarkersImageFilter);
86 
92 
94  using InputImageType = TInputImage;
95  using LabelImageType = TLabelImage;
96  using InputImagePointer = typename InputImageType::Pointer;
97  using InputImageConstPointer = typename InputImageType::ConstPointer;
99  using InputImagePixelType = typename InputImageType::PixelType;
100  using LabelImagePointer = typename LabelImageType::Pointer;
101  using LabelImageConstPointer = typename LabelImageType::ConstPointer;
103  using LabelImagePixelType = typename LabelImageType::PixelType;
104 
106 
108  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
109 
111  itkNewMacro(Self);
112 
115 
117  void SetMarkerImage(const TLabelImage *input)
118  {
119  // Process object is not const-correct so the const casting is required.
120  this->SetNthInput( 1, const_cast< TLabelImage * >( input ) );
121  }
122 
125  {
126  return itkDynamicCastInDebugMode< LabelImageType * >
127  (const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
128  }
129 
131  void SetInput1(const TInputImage *input)
132  {
133  this->SetInput(input);
134  }
135 
137  void SetInput2(const TLabelImage *input)
138  {
139  this->SetMarkerImage(input);
140  }
141 
148  itkSetMacro(FullyConnected, bool);
149  itkGetConstReferenceMacro(FullyConnected, bool);
150  itkBooleanMacro(FullyConnected);
152 
158  itkSetMacro(MarkWatershedLine, bool);
159  itkGetConstReferenceMacro(MarkWatershedLine, bool);
160  itkBooleanMacro(MarkWatershedLine);
162 
163 protected:
165  ~MorphologicalWatershedFromMarkersImageFilter() override = default;
166  void PrintSelf(std::ostream & os, Indent indent) const override;
167 
171  void GenerateInputRequestedRegion() override;
172 
176  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) override;
177 
179  void GenerateData() override;
180 
181 private:
182  bool m_FullyConnected{ false };
183 
184  bool m_MarkWatershedLine{ true };
185 }; // end of class
186 } // end namespace itk
187 
188 #ifndef ITK_MANUAL_INSTANTIATION
189 #include "itkMorphologicalWatershedFromMarkersImageFilter.hxx"
190 #endif
191 
192 #endif
Light weight base class for most itk classes.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
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
Base class for all data objects in ITK.