ITK  5.2.0
Insight Toolkit
itkMorphologicalWatershedFromMarkersImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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_MOVE(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
118  SetMarkerImage(const TLabelImage * input)
119  {
120  // Process object is not const-correct so the const casting is required.
121  this->SetNthInput(1, const_cast<TLabelImage *>(input));
122  }
123 
125  const LabelImageType *
127  {
128  return itkDynamicCastInDebugMode<LabelImageType *>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
129  }
130 
132  void
133  SetInput1(const TInputImage * input)
134  {
135  this->SetInput(input);
136  }
137 
139  void
140  SetInput2(const TLabelImage * input)
141  {
142  this->SetMarkerImage(input);
143  }
144 
151  itkSetMacro(FullyConnected, bool);
152  itkGetConstReferenceMacro(FullyConnected, bool);
153  itkBooleanMacro(FullyConnected);
155 
161  itkSetMacro(MarkWatershedLine, bool);
162  itkGetConstReferenceMacro(MarkWatershedLine, bool);
163  itkBooleanMacro(MarkWatershedLine);
165 
166 protected:
168  ~MorphologicalWatershedFromMarkersImageFilter() override = default;
169  void
170  PrintSelf(std::ostream & os, Indent indent) const override;
171 
175  void
176  GenerateInputRequestedRegion() override;
177 
181  void
182  EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
183 
185  void
186  GenerateData() override;
187 
188 private:
189  bool m_FullyConnected{ false };
190 
191  bool m_MarkWatershedLine{ true };
192 }; // end of class
193 } // end namespace itk
194 
195 #ifndef ITK_MANUAL_INSTANTIATION
196 # include "itkMorphologicalWatershedFromMarkersImageFilter.hxx"
197 #endif
198 
199 #endif
itk::MorphologicalWatershedFromMarkersImageFilter::LabelImageConstPointer
typename LabelImageType::ConstPointer LabelImageConstPointer
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:101
itk::MorphologicalWatershedFromMarkersImageFilter
Morphological watershed transform from markers.
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:81
itk::MorphologicalWatershedFromMarkersImageFilter::LabelImageType
TLabelImage LabelImageType
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:95
itk::MorphologicalWatershedFromMarkersImageFilter::SetMarkerImage
void SetMarkerImage(const TLabelImage *input)
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:118
itk::MorphologicalWatershedFromMarkersImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:97
itk::MorphologicalWatershedFromMarkersImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:96
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::MorphologicalWatershedFromMarkersImageFilter::SetInput2
void SetInput2(const TLabelImage *input)
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:140
itk::MorphologicalWatershedFromMarkersImageFilter::LabelImagePixelType
typename LabelImageType::PixelType LabelImagePixelType
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:103
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::MorphologicalWatershedFromMarkersImageFilter::LabelImageRegionType
typename LabelImageType::RegionType LabelImageRegionType
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:102
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::MorphologicalWatershedFromMarkersImageFilter::LabelImagePointer
typename LabelImageType::Pointer LabelImagePointer
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:100
itkImageToImageFilter.h
itk::MorphologicalWatershedFromMarkersImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:98
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::MorphologicalWatershedFromMarkersImageFilter::InputImageType
TInputImage InputImageType
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:94
itk::MorphologicalWatershedFromMarkersImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:99
itk::MorphologicalWatershedFromMarkersImageFilter::GetMarkerImage
const LabelImageType * GetMarkerImage() const
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:126
itk::MorphologicalWatershedFromMarkersImageFilter::IndexType
typename LabelImageType::IndexType IndexType
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:105
itk::ProcessObject::GetInput
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
itk::MorphologicalWatershedFromMarkersImageFilter::SetInput1
void SetInput1(const TInputImage *input)
Definition: itkMorphologicalWatershedFromMarkersImageFilter.h:133
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293