18 #ifndef itkShapeOpeningLabelMapFilter_h
19 #define itkShapeOpeningLabelMapFilter_h
48 template <
typename TImage>
71 static constexpr
unsigned int ImageDimension = TImage::ImageDimension;
79 #ifdef ITK_USE_CONCEPT_CHECKING
93 itkGetConstMacro(Lambda,
double);
94 itkSetMacro(Lambda,
double);
103 itkGetConstMacro(ReverseOrdering,
bool);
104 itkSetMacro(ReverseOrdering,
bool);
105 itkBooleanMacro(ReverseOrdering);
117 this->SetAttribute(LabelObjectType::GetAttributeFromName(s));
126 GenerateData()
override;
128 template <
typename TAttributeAccessor>
133 this->AllocateOutputs();
136 ImageType * output2 = this->GetOutput(1);
137 itkAssertInDebugAndIgnoreInReleaseMacro(this->GetNumberOfIndexedOutputs() == 2);
138 itkAssertInDebugAndIgnoreInReleaseMacro(output2 !=
nullptr);
142 output2->SetBackgroundValue(output->GetBackgroundValue());
146 typename ImageType::Iterator it(output);
147 while (!it.IsAtEnd())
149 const typename LabelObjectType::LabelType label = it.GetLabel();
152 if ((!m_ReverseOrdering && accessor(labelObject) < m_Lambda) ||
153 (m_ReverseOrdering && accessor(labelObject) > m_Lambda))
158 output2->AddLabelObject(labelObject);
159 output->RemoveLabel(label);
166 progress.CompletedPixel();
171 PrintSelf(std::ostream & os,
Indent indent)
const override;
175 bool m_ReverseOrdering{};
181 #ifndef ITK_MANUAL_INSTANTIATION
182 # include "itkShapeOpeningLabelMapFilter.hxx"