18#ifndef itkShapeRelabelLabelMapFilter_h
19#define itkShapeRelabelLabelMapFilter_h
45template <
typename TImage>
68 static constexpr unsigned int ImageDimension = TImage::ImageDimension;
76#ifdef ITK_USE_CONCEPT_CHECKING
92 itkSetMacro(ReverseOrdering,
bool);
93 itkGetConstReferenceMacro(ReverseOrdering,
bool);
94 itkBooleanMacro(ReverseOrdering);
106 this->SetAttribute(LabelObjectType::GetAttributeFromName(s));
117 template <
typename TAttributeAccessor>
122 this->AllocateOutputs();
127 using VectorType = std::vector<LabelObjectPointer>;
133 labelObjects.reserve(output->GetNumberOfLabelObjects());
134 for (
typename ImageType::Iterator it(output); !it.IsAtEnd(); ++it)
136 labelObjects.push_back(it.GetLabelObject());
141 if (m_ReverseOrdering)
143 std::sort(labelObjects.begin(),
149 std::sort(labelObjects.begin(),
156 output->ClearLabels();
158 typename VectorType::const_iterator it2 = labelObjects.begin();
159 while (it2 != labelObjects.end())
162 if (label == output->GetBackgroundValue())
166 (*it2)->SetLabel(label);
167 output->AddLabelObject(*it2);
180 bool m_ReverseOrdering{};
186#ifndef ITK_MANUAL_INSTANTIATION
187# include "itkShapeRelabelLabelMapFilter.hxx"
Base class for filters that takes an image as input and overwrites that image as the output.
Control indentation during Print() invocation.
Light weight base class for most itk classes.
Implements progress tracking for a filter.
Relabels objects according to their shape attributes.
~ShapeRelabelLabelMapFilter() override=default
void PrintSelf(std::ostream &os, Indent indent) const override
void SetAttribute(const std::string &s)
ShapeRelabelLabelMapFilter()
typename ImageType::ConstPointer ImageConstPointer
void TemplatedGenerateData(const TAttributeAccessor &)
typename ImageType::Pointer ImagePointer
typename ImageType::LabelObjectType LabelObjectType
typename ImageType::PixelType PixelType
typename ImageType::IndexType IndexType
typename LabelObjectType::AttributeType AttributeType
void GenerateData() override
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
ImageBaseType::IndexType IndexType
ImageBaseType::SpacingType VectorType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....