18#ifndef itkShapeRelabelLabelMapFilter_h
19#define itkShapeRelabelLabelMapFilter_h
45template <
typename TImage>
88 itkSetMacro(ReverseOrdering,
bool);
89 itkGetConstReferenceMacro(ReverseOrdering,
bool);
90 itkBooleanMacro(ReverseOrdering);
102 this->
SetAttribute(LabelObjectType::GetAttributeFromName(s));
113 template <
typename TAttributeAccessor>
122 using LabelObjectPointer =
typename LabelObjectType::Pointer;
123 using VectorType = std::vector<LabelObjectPointer>;
128 VectorType labelObjects;
129 labelObjects.reserve(output->GetNumberOfLabelObjects());
130 for (
typename ImageType::Iterator it(output); !it.IsAtEnd(); ++it)
132 labelObjects.push_back(it.GetLabelObject());
139 std::sort(labelObjects.begin(),
145 std::sort(labelObjects.begin(),
152 output->ClearLabels();
154 auto it2 = labelObjects.begin();
155 while (it2 != labelObjects.end())
158 if (label == output->GetBackgroundValue())
162 (*it2)->SetLabel(label);
163 output->AddLabelObject(*it2);
182#ifndef ITK_MANUAL_INSTANTIATION
183# include "itkShapeRelabelLabelMapFilter.hxx"
OutputImageType * GetOutput()
InPlaceLabelMapFilter()=default
void AllocateOutputs() override
Control indentation during Print() invocation.
Implements progress tracking for a filter.
~ShapeRelabelLabelMapFilter() override=default
SmartPointer< const Self > ConstPointer
ShapeRelabelLabelMapFilter Self
virtual void SetAttribute(AttributeType _arg)
void PrintSelf(std::ostream &os, Indent indent) const override
AttributeType m_Attribute
void SetAttribute(const std::string &s)
ShapeRelabelLabelMapFilter()
typename ImageType::ConstPointer ImageConstPointer
void TemplatedGenerateData(const TAttributeAccessor &)
static constexpr unsigned int ImageDimension
typename ImageType::Pointer ImagePointer
InPlaceLabelMapFilter< LabelMapType > Superclass
typename ImageType::LabelObjectType LabelObjectType
SmartPointer< Self > Pointer
typename ImageType::PixelType PixelType
typename ImageType::IndexType IndexType
typename LabelObjectType::AttributeType AttributeType
void GenerateData() override
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....