18 #ifndef itkShapeOpeningLabelMapFilter_h
19 #define itkShapeOpeningLabelMapFilter_h
49 template <
typename TImage>
72 static constexpr
unsigned int ImageDimension = TImage::ImageDimension;
80 #ifdef ITK_USE_CONCEPT_CHECKING
94 itkGetConstMacro(Lambda,
double);
95 itkSetMacro(Lambda,
double);
104 itkGetConstMacro(ReverseOrdering,
bool);
105 itkSetMacro(ReverseOrdering,
bool);
106 itkBooleanMacro(ReverseOrdering);
118 this->SetAttribute(LabelObjectType::GetAttributeFromName(s));
127 GenerateData()
override;
129 template <
typename TAttributeAccessor>
134 this->AllocateOutputs();
137 ImageType * output2 = this->GetOutput(1);
138 itkAssertInDebugAndIgnoreInReleaseMacro(this->GetNumberOfIndexedOutputs() == 2);
139 itkAssertInDebugAndIgnoreInReleaseMacro(output2 !=
nullptr);
143 output2->SetBackgroundValue(output->GetBackgroundValue());
147 typename ImageType::Iterator it(output);
148 while (!it.IsAtEnd())
150 typename LabelObjectType::LabelType label = it.GetLabel();
153 if ((!m_ReverseOrdering && accessor(labelObject) < m_Lambda) ||
154 (m_ReverseOrdering && accessor(labelObject) > m_Lambda))
159 output2->AddLabelObject(labelObject);
160 output->RemoveLabel(label);
167 progress.CompletedPixel();
172 PrintSelf(std::ostream & os,
Indent indent)
const override;
182 #ifndef ITK_MANUAL_INSTANTIATION
183 # include "itkShapeOpeningLabelMapFilter.hxx"