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
ImageType::ConstPointer ImageConstPointer
ShapeRelabelLabelMapFilter()
OutputImageType * GetOutput(void)
void PrintSelf(std::ostream &os, Indent indent) const
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.
virtual void AllocateOutputs()
InPlaceLabelMapFilter< TImage > Superclass
Control indentation during Print() invocation.
ImageType::PixelType PixelType
AttributeType m_Attribute
void TemplatedGenerateData(const TAttributeAccessor &)
ImageType::Pointer ImagePointer
void operator=(const Self &)
SmartPointer< const Self > ConstPointer