ITK  5.4.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 * https://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
22
23namespace itk
24{
80template <typename TInputImage, typename TLabelImage>
82 : public ImageToImageFilter<TInputImage, TLabelImage>
83{
84public:
85 ITK_DISALLOW_COPY_AND_MOVE(MorphologicalWatershedFromMarkersImageFilter);
86
92
94 using InputImageType = TInputImage;
95 using LabelImageType = TLabelImage;
99 using InputImagePixelType = typename InputImageType::PixelType;
103 using LabelImagePixelType = typename LabelImageType::PixelType;
104
106
108 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
109
111 itkNewMacro(Self);
112
114 itkOverrideGetNameOfClassMacro(MorphologicalWatershedFromMarkersImageFilter);
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);
161 itkSetMacro(MarkWatershedLine, bool);
162 itkGetConstReferenceMacro(MarkWatershedLine, bool);
163 itkBooleanMacro(MarkWatershedLine);
166protected:
169 void
170 PrintSelf(std::ostream & os, Indent indent) const override;
171
175 void
177
181 void
182 EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
183
185 void
186 GenerateData() override;
187
188private:
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
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:50
Light weight base class for most itk classes.
void EnlargeOutputRequestedRegion(DataObject *) override
~MorphologicalWatershedFromMarkersImageFilter() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....