18 #ifndef itkShapeRelabelLabelMapFilter_h
19 #define itkShapeRelabelLabelMapFilter_h
44 template<
typename TImage >
74 #ifdef ITK_USE_CONCEPT_CHECKING
90 itkSetMacro(ReverseOrdering,
bool);
91 itkGetConstReferenceMacro(ReverseOrdering,
bool);
92 itkBooleanMacro(ReverseOrdering);
103 this->
SetAttribute( LabelObjectType::GetAttributeFromName(s) );
113 template< typename TAttributeAccessor >
121 typedef typename LabelObjectType::Pointer LabelObjectPointer;
122 typedef std::vector< LabelObjectPointer > VectorType;
124 ProgressReporter progress(
this, 0, 2 * output->GetNumberOfLabelObjects() );
127 VectorType labelObjects;
128 labelObjects.reserve( output->GetNumberOfLabelObjects() );
129 for (
typename ImageType::Iterator it( output );
133 labelObjects.push_back(it.GetLabelObject());
140 std::sort( labelObjects.begin(), labelObjects.end(),
145 std::sort( labelObjects.begin(), labelObjects.end(),
151 output->ClearLabels();
153 typename VectorType::const_iterator it2 = labelObjects.begin();
154 while ( it2 != labelObjects.end() )
157 if ( label == output->GetBackgroundValue() )
161 ( *it2 )->SetLabel(label);
162 output->AddLabelObject(*it2);
166 progress.CompletedPixel();
184 #ifndef ITK_MANUAL_INSTANTIATION
185 #include "itkShapeRelabelLabelMapFilter.hxx"
Relabels objects according to their shape attributes.
Light weight base class for most itk classes.
~ShapeRelabelLabelMapFilter()
ShapeRelabelLabelMapFilter Self
ImageType::IndexType IndexType
virtual void AllocateOutputs() override
ImageType::ConstPointer ImageConstPointer
ShapeRelabelLabelMapFilter()
void SetAttribute(const std::string &s)
ImageType::LabelObjectType LabelObjectType
static const unsigned int ImageDimension
virtual void SetAttribute(AttributeType _arg)
SmartPointer< Self > Pointer
Base class for filters that takes an image as input and overwrites that image as the output...
LabelObjectType::AttributeType AttributeType
Implements progress tracking for a filter.
InPlaceLabelMapFilter< TImage > Superclass
void GenerateData() override
OutputImageType * GetOutput()
Control indentation during Print() invocation.
ImageType::PixelType PixelType
void PrintSelf(std::ostream &os, Indent indent) const override
AttributeType m_Attribute
void TemplatedGenerateData(const TAttributeAccessor &)
ImageType::Pointer ImagePointer
void operator=(const Self &)
SmartPointer< const Self > ConstPointer