18 #ifndef __itkShapeUniqueLabelMapFilter_h
19 #define __itkShapeUniqueLabelMapFilter_h
41 template<
typename TImage >
59 typedef typename LabelObjectType::LineType
LineType;
65 TImage::ImageDimension);
74 #ifdef ITK_USE_CONCEPT_CHECKING
91 itkGetConstMacro(ReverseOrdering,
bool);
92 itkSetMacro(ReverseOrdering,
bool);
93 itkBooleanMacro(ReverseOrdering);
104 this->
SetAttribute( LabelObjectType::GetAttributeFromName(s) );
114 template<
typename TAttributeAccessor >
121 typedef typename std::priority_queue< LineOfLabelObject, std::vector< LineOfLabelObject >,
123 PriorityQueueType pq;
128 for (
typename ImageType::Iterator it2( this->
GetLabelMap() );
137 typename LabelObjectType::ConstLineIterator lit( lo );
138 while( ! lit.IsAtEnd() )
157 typedef typename std::deque< LineOfLabelObject > LinesType;
160 lines.push_back( pq.top() );
165 while ( !pq.empty() )
171 bool newMainLine =
false;
175 if ( idx[i] != prevIdx[i] )
191 if ( prevIdx[0] + prevLength >= idx[0] )
200 typename TAttributeAccessor::AttributeValueType prevAttr = accessor(prev.
labelObject);
201 typename TAttributeAccessor::AttributeValueType attr = accessor(l.
labelObject);
204 if ( attr == prevAttr )
217 if ( attr > prevAttr )
234 if ( prevIdx[0] + prevLength > idx[0] + length )
240 newIdx[0] = idx[0] + length;
245 prevLength = idx[0] - prevIdx[0];
246 if ( prevLength != 0 )
248 lines.back(). line.SetLength(idx[0] - prevIdx[0]);
263 if ( prevIdx[0] + prevLength > idx[0] + length )
270 newIdx[0] = prevIdx[0] + prevLength;
272 l.
line.SetIndex(newIdx);
273 l.
line.SetLength(newLength);
287 prevIdx = prev.
line.GetIndex();
291 for (
unsigned int i = 0; i < lines.size(); i++ )
298 typename ImageType::Iterator it( this->
GetLabelMap() );
299 while ( ! it.IsAtEnd() )
301 typename LabelObjectType::LabelType label = it.GetLabel();
304 if ( labelObject->Empty() )
328 typedef typename LabelObjectType::LineType
LineType;
346 if ( lla.
line.GetIndex()[i] > llb.
line.GetIndex()[i] )
350 else if ( lla.
line.GetIndex()[i] < llb.
line.GetIndex()[i] )
361 #ifndef ITK_MANUAL_INSTANTIATION
362 #include "itkShapeUniqueLabelMapFilter.hxx"
bool operator()(const LineOfLabelObject &lla, const LineOfLabelObject &llb)
~ShapeUniqueLabelMapFilter()
Light weight base class for most itk classes.
signed long OffsetValueType
virtual void SetAttribute(AttributeType _arg)
LabelObjectType::LineType LineType
SmartPointer< Self > Pointer
virtual InputImageType * GetLabelMap()
void PrintSelf(std::ostream &os, Indent indent) const
ImageType::LabelObjectType LabelObjectType
ImageType::IndexType IndexType
ImageType::ConstPointer ImageConstPointer
Base class for filters that takes an image as input and overwrites that image as the output...
ImageType::Pointer ImagePointer
Remove some pixels in the label object according to the value of their shape attribute to ensure that...
SmartPointer< const Self > ConstPointer
LabelObjectType::LineType LineType
static const unsigned int ImageDimension
ShapeUniqueLabelMapFilter()
Implements progress tracking for a filter.
virtual void AllocateOutputs()
LabelObjectType * labelObject
LabelObjectType::AttributeType AttributeType
void operator=(const Self &)
ImageType::PixelType PixelType
void TemplatedGenerateData(const TAttributeAccessor &accessor)
void SetAttribute(const std::string &s)
LineOfLabelObject(const LineType _line, LabelObjectType *_lo)
Control indentation during Print() invocation.
InPlaceLabelMapFilter< TImage > Superclass
AttributeType m_Attribute
ShapeUniqueLabelMapFilter Self