/usr/include/InsightToolkit/Review/itkLabelObject.h is in libinsighttoolkit3-dev 3.20.1+git20120521-6build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | /*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: itkLabelObject.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkLabelObject_h
#define __itkLabelObject_h
#include <deque>
#include "itkLightObject.h"
#include "itkLabelObjectLine.h"
#include "itkWeakPointer.h"
#include "itkObjectFactory.h"
namespace itk
{
/** \class LabelObject
* \brief The base class for the representation of an labeled binary object in an image.
*
* LabelObject is the base class to represent a labeled object in an image.
* It should be used associated with the LabelMap.
*
* LabelObject store mainly 2 things: the label of the object, and a set of lines
* which are part of the object.
* No attribute is available in that class, so this class can be used as a base class
* to implement a label object with attribute, or when no attribute is needed (see the
* reconstruction filters for an example. If a simple attribute is needed,
* AttributeLabelObject can be used directly.
*
* All the subclasses of LabelObject have to reinplement the CopyAttributesFrom() method.
*
* \author Gaetan Lehmann. Biologie du Developpement et de la Reproduction, INRA de Jouy-en-Josas, France.
*
* This implementation was taken from the Insight Journal paper:
* http://hdl.handle.net/1926/584 or
* http://www.insight-journal.org/browse/publication/176
*
* \sa LabelMapFilter, AttributeLabelObject
* \ingroup DataRepresentation
* \ingroup LabeledImageObject
*/
template < class TLabel, unsigned int VImageDimension >
class ITK_EXPORT LabelObject : public LightObject
{
public:
/** Standard class typedefs */
typedef LabelObject Self;
typedef LightObject Superclass;
typedef Self LabelObjectType;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
typedef WeakPointer<const Self> ConstWeakPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(LabelObject, LightObject);
itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
typedef Index< VImageDimension > IndexType;
typedef TLabel LabelType;
typedef LabelObjectLine< VImageDimension > LineType;
typedef typename LineType::LengthType LengthType;
typedef typename std::deque< LineType > LineContainerType;
typedef unsigned int AttributeType;
typedef unsigned long SizeValueType;
itkStaticConstMacro(LABEL, AttributeType, 0);
static AttributeType GetAttributeFromName( const std::string & s );
static std::string GetNameFromAttribute( const AttributeType & a );
/**
* Set/Get the label associated with the object.
*/
const LabelType & GetLabel() const;
void SetLabel( const LabelType & label );
/**
* Return true if the object contain the given index and false otherwise.
* Worst case complexity is O(L) where L is the number of lines in the object.
*/
bool HasIndex( const IndexType & idx ) const;
/**
* Add an index to the object. If the index is already in the object, the index can
* be found several time in the object.
*/
void AddIndex( const IndexType & idx );
/**
* Add a new line to the object, without any check.
*/
void AddLine( const IndexType & idx, const LengthType & length );
/**
* Add a new line to the object, without any check.
*/
void AddLine( const LineType & line );
/** Return the line container of this object */
const LineContainerType & GetLineContainer() const;
LineContainerType & GetLineContainer();
void SetLineContainer( const LineContainerType & lineContainer );
SizeValueType GetNumberOfLines() const;
const LineType & GetLine( SizeValueType i ) const;
LineType & GetLine( SizeValueType i );
SizeValueType Size() const;
bool Empty() const;
IndexType GetIndex( SizeValueType offset ) const;
/** Copy the attributes of another node to this one */
virtual void CopyAttributesFrom( const Self * src );
/** Copy the lines, the label and the attributes from another node. */
void CopyAllFrom( const Self * src );
/** Reorder the lines, merge the touching lines and ensure that no
* pixel is covered by two lines
*/
void Optimize();
protected:
LabelObject();
void PrintSelf(std::ostream& os, Indent indent) const;
private:
LabelObject(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
LineContainerType m_LineContainer;
LabelType m_Label;
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkLabelObject.txx"
#endif
#endif
|