ITK  5.2.0
Insight Toolkit
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
itk::LabelMap< TLabelObject > Class Template Reference

#include <itkLabelMap.h>

+ Inheritance diagram for itk::LabelMap< TLabelObject >:
+ Collaboration diagram for itk::LabelMap< TLabelObject >:

Classes

class  ConstIterator
 
class  Iterator
 

Public Types

using ConstPointer = SmartPointer< const Self >
 
using ConstWeakPointer = WeakPointer< const Self >
 
using DirectionType = typename Superclass::DirectionType
 
using IndexType = typename Superclass::IndexType
 
using LabelObjectPointerType = typename LabelObjectType::Pointer
 
using LabelObjectType = TLabelObject
 
using LabelObjectVectorType = std::vector< LabelObjectPointerType >
 
using LabelType = typename LabelObjectType::LabelType
 
using LabelVectorType = std::vector< LabelType >
 
using LengthType = SizeValueType
 
using OffsetType = typename Superclass::OffsetType
 
using OffsetValueType = typename Superclass::OffsetValueType
 
using PixelType = LabelType
 
using Pointer = SmartPointer< Self >
 
using PointType = typename Superclass::PointType
 
using RegionType = typename Superclass::RegionType
 
using Self = LabelMap
 
using SizeType = typename Superclass::SizeType
 
using SizeValueType = typename Superclass::SizeValueType
 
using SpacingType = typename Superclass::SpacingType
 
using Superclass = ImageBase< TLabelObject::ImageDimension >
 
- Public Types inherited from itk::ImageBase< TLabelObject::ImageDimension >
using ConstPointer = SmartPointer< const Self >
 
using DirectionType = Matrix< SpacePrecisionType, VImageDimension, VImageDimension >
 
using ImageDimensionType = unsigned int
 
using IndexType = Index< VImageDimension >
 
using IndexValueType = typename IndexType::IndexValueType
 
using OffsetType = Offset< VImageDimension >
 
using OffsetValueType = typename OffsetType::OffsetValueType
 
using Pointer = SmartPointer< Self >
 
using PointType = Point< PointValueType, VImageDimension >
 
using PointValueType = SpacePrecisionType
 
using RegionType = ImageRegion< VImageDimension >
 
using Self = ImageBase
 
using SizeType = Size< VImageDimension >
 
using SizeValueType = typename SizeType::SizeValueType
 
using SpacingType = Vector< SpacingValueType, VImageDimension >
 
using SpacingValueType = SpacePrecisionType
 
using Superclass = DataObject
 
- Public Types inherited from itk::DataObject
using ConstPointer = SmartPointer< const Self >
 
using DataObjectIdentifierType = std::string
 
using DataObjectPointerArraySizeType = std::vector< Pointer >::size_type
 
using Pointer = SmartPointer< Self >
 
using Self = DataObject
 
using Superclass = Object
 
- Public Types inherited from itk::Object
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = Object
 
using Superclass = LightObject
 
- Public Types inherited from itk::LightObject
using ConstPointer = SmartPointer< const Self >
 
using Pointer = SmartPointer< Self >
 
using Self = LightObject
 

Public Member Functions

void Allocate (bool initialize=false) override
 
virtual ::itk::LightObject::Pointer CreateAnother () const
 
virtual const char * GetNameOfClass () const
 
virtual void Graft (const Self *imgData)
 
void Initialize () override
 
- Public Member Functions inherited from itk::ImageBase< TLabelObject::ImageDimension >
virtual ::itk::LightObject::Pointer CreateAnother () const
 
void Initialize () override
 
virtual void SetOrigin (PointType _arg)
 
virtual void SetOrigin (const double origin[VImageDimension])
 
virtual void SetOrigin (const float origin[VImageDimension])
 
virtual void SetDirection (const DirectionType &direction)
 
virtual const DirectionTypeGetDirection () const
 
virtual const DirectionTypeGetInverseDirection () const
 
virtual const SpacingTypeGetSpacing () const
 
virtual const PointTypeGetOrigin () const
 
virtual void SetLargestPossibleRegion (const RegionType &region)
 
virtual const RegionTypeGetLargestPossibleRegion () const
 
virtual void SetBufferedRegion (const RegionType &region)
 
virtual const RegionTypeGetBufferedRegion () const
 
virtual void SetRequestedRegion (const RegionType &region)
 
void SetRequestedRegion (const DataObject *data) override
 
virtual const RegionTypeGetRequestedRegion () const
 
virtual void SetRegions (const RegionType &region)
 
virtual void SetRegions (const SizeType &size)
 
const OffsetValueTypeGetOffsetTable () const
 
OffsetValueType ComputeOffset (const IndexType &ind) const
 
IndexType ComputeIndex (OffsetValueType offset) const
 
virtual void SetSpacing (const SpacingType &spacing)
 
virtual void SetSpacing (const double spacing[VImageDimension])
 
virtual void SetSpacing (const float spacing[VImageDimension])
 
IndexType TransformPhysicalPointToIndex (const Point< TCoordRep, VImageDimension > &point) const
 
bool TransformPhysicalPointToIndex (const Point< TCoordRep, VImageDimension > &point, IndexType &index) const
 
ContinuousIndex< TIndexRep, VImageDimension > TransformPhysicalPointToContinuousIndex (const Point< TCoordRep, VImageDimension > &point) const
 
bool TransformPhysicalPointToContinuousIndex (const Point< TCoordRep, VImageDimension > &point, ContinuousIndex< TIndexRep, VImageDimension > &index) const
 
void TransformContinuousIndexToPhysicalPoint (const ContinuousIndex< TIndexRep, VImageDimension > &index, Point< TCoordRep, VImageDimension > &point) const
 
Point< TCoordRep, VImageDimension > TransformContinuousIndexToPhysicalPoint (const ContinuousIndex< TIndexRep, VImageDimension > &index) const
 
void TransformIndexToPhysicalPoint (const IndexType &index, Point< TCoordRep, VImageDimension > &point) const
 
Point< TCoordRep, VImageDimension > TransformIndexToPhysicalPoint (const IndexType &index) const
 
void TransformLocalVectorToPhysicalVector (const FixedArray< TCoordRep, VImageDimension > &inputGradient, FixedArray< TCoordRep, VImageDimension > &outputGradient) const
 
TVector TransformLocalVectorToPhysicalVector (const TVector &inputGradient) const
 
void TransformPhysicalVectorToLocalVector (const FixedArray< TCoordRep, VImageDimension > &inputGradient, FixedArray< TCoordRep, VImageDimension > &outputGradient) const
 
TVector TransformPhysicalVectorToLocalVector (const TVector &inputGradient) const
 
void CopyInformation (const DataObject *data) override
 
void UpdateOutputInformation () override
 
void UpdateOutputData () override
 
void SetRequestedRegionToLargestPossibleRegion () override
 
bool RequestedRegionIsOutsideOfTheBufferedRegion () override
 
bool VerifyRequestedRegion () override
 
virtual unsigned int GetNumberOfComponentsPerPixel () const
 
virtual void SetNumberOfComponentsPerPixel (unsigned int)
 
- Public Member Functions inherited from itk::DataObject
void DisconnectPipeline ()
 
bool GetDataReleased () const
 
virtual const bool & GetReleaseDataFlag () const
 
SmartPointer< ProcessObjectGetSource () const
 
DataObjectPointerArraySizeType GetSourceOutputIndex () const
 
const DataObjectIdentifierTypeGetSourceOutputName () const
 
virtual void PropagateRequestedRegion ()
 
void ReleaseData ()
 
virtual void ReleaseDataFlagOff ()
 
virtual void ReleaseDataFlagOn ()
 
virtual void ResetPipeline ()
 
void SetReleaseDataFlag (bool flag)
 
bool ShouldIReleaseData () const
 
virtual void Update ()
 
void SetPipelineMTime (ModifiedTimeType time)
 
virtual const ModifiedTimeTypeGetPipelineMTime () const
 
virtual ModifiedTimeType GetUpdateMTime () const
 
virtual void SetRealTimeStamp (RealTimeStamp _arg)
 
virtual const RealTimeStampGetRealTimeStamp () const
 
virtual void PrepareForNewData ()
 
virtual void DataHasBeenGenerated ()
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
unsigned long AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
MetaDataDictionaryGetMetaDataDictionary ()
 
const MetaDataDictionaryGetMetaDataDictionary () const
 
virtual ModifiedTimeType GetMTime () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetReferenceCount (int) override
 
void UnRegister () const noexcept override
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
void SetMetaDataDictionary (MetaDataDictionary &&rrhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual const std::string & GetObjectName () const
 
- Public Member Functions inherited from itk::LightObject
Pointer Clone () const
 
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
void Print (std::ostream &os, Indent indent=0) const
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::ImageBase< TLabelObject::ImageDimension >
static unsigned int GetImageDimension ()
 
static Pointer New ()
 
- Static Public Member Functions inherited from itk::DataObject
static bool GetGlobalReleaseDataFlag ()
 
static void GlobalReleaseDataFlagOff ()
 
static void GlobalReleaseDataFlagOn ()
 
static Pointer New ()
 
static void SetGlobalReleaseDataFlag (bool val)
 
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool val)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Static Public Attributes

static constexpr unsigned int ImageDimension = LabelObjectType::ImageDimension
 
- Static Public Attributes inherited from itk::ImageBase< TLabelObject::ImageDimension >
static constexpr ImageDimensionType ImageDimension
 
using LabelObjectContainerType = std::map< LabelType, LabelObjectPointerType >
 
using LabelObjectContainerIterator = typename LabelObjectContainerType::iterator
 
using LabelObjectContainerConstIterator = typename LabelObjectContainerType::const_iterator
 
LabelObjectContainerType m_LabelObjectContainer
 
LabelType m_BackgroundValue
 
LabelObjectTypeGetLabelObject (const LabelType &label)
 
const LabelObjectTypeGetLabelObject (const LabelType &label) const
 
bool HasLabel (const LabelType label) const
 
LabelObjectTypeGetNthLabelObject (const SizeValueType &pos)
 
const LabelObjectTypeGetNthLabelObject (const SizeValueType &pos) const
 
const LabelTypeGetPixel (const IndexType &idx) const
 
void SetPixel (const IndexType &idx, const LabelType &iLabel)
 
void AddPixel (const IndexType &idx, const LabelType &label)
 
void RemovePixel (const IndexType &idx, const LabelType &label)
 
void SetLine (const IndexType &idx, const LengthType &length, const LabelType &label)
 
LabelObjectTypeGetLabelObject (const IndexType &idx) const
 
void AddLabelObject (LabelObjectType *labelObject)
 
void PushLabelObject (LabelObjectType *labelObject)
 
void RemoveLabelObject (LabelObjectType *labelObject)
 
void RemoveLabel (const LabelType &label)
 
void ClearLabels ()
 
Self::SizeValueType GetNumberOfLabelObjects () const
 
LabelVectorType GetLabels () const
 
LabelObjectVectorType GetLabelObjects () const
 
virtual LabelType GetBackgroundValue () const
 
virtual void SetBackgroundValue (LabelType _arg)
 
void PrintLabelObjects (std::ostream &os) const
 
void PrintLabelObjects () const
 
void Optimize ()
 
 LabelMap ()
 
 ~LabelMap () override=default
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
void Graft (const DataObject *data) override
 
void AddPixel (const LabelObjectContainerIterator &it, const IndexType &idx, const LabelType &label)
 
void RemovePixel (const LabelObjectContainerIterator &it, const IndexType &idx, bool iEmitModifiedEvent)
 

Additional Inherited Members

- Protected Member Functions inherited from itk::ImageBase< TLabelObject::ImageDimension >
void Graft (const DataObject *data) override
 
 ImageBase ()
 
 ~ImageBase () override=default
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
void ComputeOffsetTable ()
 
virtual void ComputeIndexToPhysicalPointMatrices ()
 
virtual void InitializeBufferedRegion ()
 
OffsetValueType FastComputeOffset (const IndexType &ind) const
 
IndexType FastComputeIndex (OffsetValueType offset) const
 
- Protected Member Functions inherited from itk::DataObject
 DataObject ()
 
 ~DataObject () override
 
virtual void PropagateResetPipeline ()
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
 ~Object () override
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void SetTimeStamp (const TimeStamp &timeStamp)
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 
- Protected Attributes inherited from itk::ImageBase< TLabelObject::ImageDimension >
SpacingType m_Spacing
 
PointType m_Origin
 
DirectionType m_Direction
 
DirectionType m_InverseDirection
 
DirectionType m_IndexToPhysicalPoint
 
DirectionType m_PhysicalPointToIndex
 
- Protected Attributes inherited from itk::LightObject
std::atomic< int > m_ReferenceCount
 

Detailed Description

template<typename TLabelObject>
class itk::LabelMap< TLabelObject >

Templated n-dimensional image to store labeled objects.

LabelMap is an image class specialized in storing the labeled images. It represent the image in a different way than itk::Image. Instead of storing the content of the image in an array of pixels values, it store the a collection of labeled objects, and a background value. This way of storing the content of the image allow an easy and efficient manipulation of the objects in the image.

The LabelMap shares a lot of methods with the itk::Image class. it make it usable as input or output of the itk::ImageToImageFilter for example. However the methods don't have the same complexity in the 2 classes, because of the different way to store the data. GetPixel() is run in constant time for example in itk::Image, but have a worst case complexity of O(L), where L is the number of lines in the image (imageSize[1] * imageSize[2] for a 3D image).

To iterate over the LabelObjects in the map, use:

for(unsigned int i = 0; i < filter->GetOutput()->GetNumberOfLabelObjects(); ++i)
{
FilterType::OutputImageType::LabelObjectType* labelObject =
filter->GetOutput()->GetNthLabelObject(i);
}
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: https://www.insight-journal.org/browse/publication/176

ITK Sphinx Examples:
Examples
SphinxExamples/src/Filtering/ImageFusion/OverlayLabelMapOnTopOfAnImage/Code.cxx, SphinxExamples/src/Filtering/LabelMap/ApplyMorphologicalClosingOnAllLabelObjects/Code.cxx, SphinxExamples/src/Filtering/LabelMap/ApplyMorphologicalClosingOnSpecificLabelObject/Code.cxx, SphinxExamples/src/Filtering/LabelMap/ExtractGivenLabelObject/Code.cxx, SphinxExamples/src/Filtering/LabelMap/MaskOneImageGivenLabelMap/Code.cxx, and SphinxExamples/src/Filtering/LabelMap/ShapeAttributesForBinaryImage/Code.cxx.

Definition at line 70 of file itkLabelMap.h.

Member Typedef Documentation

◆ ConstPointer

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::ConstPointer = SmartPointer<const Self>

Definition at line 80 of file itkLabelMap.h.

◆ ConstWeakPointer

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::ConstWeakPointer = WeakPointer<const Self>

Definition at line 81 of file itkLabelMap.h.

◆ DirectionType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::DirectionType = typename Superclass::DirectionType

Direction type alias support A matrix of direction cosines.

Definition at line 120 of file itkLabelMap.h.

◆ IndexType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::IndexType = typename Superclass::IndexType

Index type alias support An index is used to access pixel values.

Definition at line 111 of file itkLabelMap.h.

◆ LabelObjectContainerConstIterator

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::LabelObjectContainerConstIterator = typename LabelObjectContainerType::const_iterator
private

the LabelObject container type

Definition at line 510 of file itkLabelMap.h.

◆ LabelObjectContainerIterator

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::LabelObjectContainerIterator = typename LabelObjectContainerType::iterator
private

the LabelObject container type

Definition at line 509 of file itkLabelMap.h.

◆ LabelObjectContainerType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::LabelObjectContainerType = std::map<LabelType, LabelObjectPointerType>
private

the LabelObject container type

Definition at line 508 of file itkLabelMap.h.

◆ LabelObjectPointerType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::LabelObjectPointerType = typename LabelObjectType::Pointer

Definition at line 91 of file itkLabelMap.h.

◆ LabelObjectType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::LabelObjectType = TLabelObject

Definition at line 89 of file itkLabelMap.h.

◆ LabelObjectVectorType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::LabelObjectVectorType = std::vector<LabelObjectPointerType>

Definition at line 108 of file itkLabelMap.h.

◆ LabelType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::LabelType = typename LabelObjectType::LabelType

Label type alias support

Definition at line 103 of file itkLabelMap.h.

◆ LabelVectorType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::LabelVectorType = std::vector<LabelType>

types used to expose labels only and label objects only

Definition at line 107 of file itkLabelMap.h.

◆ LengthType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::LengthType = SizeValueType

Definition at line 94 of file itkLabelMap.h.

◆ OffsetType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::OffsetType = typename Superclass::OffsetType

Offset type alias support An offset is used to access pixel values.

Definition at line 114 of file itkLabelMap.h.

◆ OffsetValueType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::OffsetValueType = typename Superclass::OffsetValueType

Offset type alias (relative position between indices)

Definition at line 135 of file itkLabelMap.h.

◆ PixelType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::PixelType = LabelType

Definition at line 104 of file itkLabelMap.h.

◆ Pointer

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::Pointer = SmartPointer<Self>

Definition at line 79 of file itkLabelMap.h.

◆ PointType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::PointType = typename Superclass::PointType

Origin type alias support The origin is the geometric coordinates of the index (0,0).

Definition at line 132 of file itkLabelMap.h.

◆ RegionType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::RegionType = typename Superclass::RegionType

Region type alias support A region is used to specify a subset of an image.

Definition at line 124 of file itkLabelMap.h.

◆ Self

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::Self = LabelMap

Standard class type aliases

Definition at line 77 of file itkLabelMap.h.

◆ SizeType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::SizeType = typename Superclass::SizeType

Size type alias support A size is used to define region bounds.

Definition at line 117 of file itkLabelMap.h.

◆ SizeValueType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::SizeValueType = typename Superclass::SizeValueType

Definition at line 93 of file itkLabelMap.h.

◆ SpacingType

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::SpacingType = typename Superclass::SpacingType

Spacing type alias support Spacing holds the size of a pixel. The spacing is the geometric distance between image samples.

Definition at line 128 of file itkLabelMap.h.

◆ Superclass

template<typename TLabelObject >
using itk::LabelMap< TLabelObject >::Superclass = ImageBase<TLabelObject::ImageDimension>

Definition at line 78 of file itkLabelMap.h.

Constructor & Destructor Documentation

◆ LabelMap()

template<typename TLabelObject >
itk::LabelMap< TLabelObject >::LabelMap ( )
protected

the LabelObject container type

◆ ~LabelMap()

template<typename TLabelObject >
itk::LabelMap< TLabelObject >::~LabelMap ( )
overrideprotecteddefault

the LabelObject container type

Member Function Documentation

◆ AddLabelObject()

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::AddLabelObject ( LabelObjectType labelObject)

Add a label object to the image. If a label object already has the label, it is overriden.

◆ AddPixel() [1/2]

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::AddPixel ( const IndexType idx,
const LabelType label 
)

Add index idx to the label object whose label is label. If no label object has the label label, the corresponding label object is created. The worst case complexity of this method is O(L) where L is the number of lines in the image. However, the execution time will be quite low if the pixels are set in the image in raster mode.

◆ AddPixel() [2/2]

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::AddPixel ( const LabelObjectContainerIterator it,
const IndexType idx,
const LabelType label 
)
private

the LabelObject container type

◆ Allocate()

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::Allocate ( bool  initialize = false)
overridevirtual

Allocate the image memory. The size of the image must already be set, e.g. by calling SetRegions() or SetBufferedRegion().

This method should be pure virtual, if backwards compatibility was not required.

Reimplemented from itk::ImageBase< TLabelObject::ImageDimension >.

◆ ClearLabels()

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::ClearLabels ( )

Remove all the labels in the image

◆ CreateAnother()

template<typename TLabelObject >
virtual::itk::LightObject::Pointer itk::LabelMap< TLabelObject >::CreateAnother ( ) const
virtual

Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.

Reimplemented from itk::Object.

◆ GetBackgroundValue()

template<typename TLabelObject >
virtual LabelType itk::LabelMap< TLabelObject >::GetBackgroundValue ( ) const
virtual

Set/Get the background label

◆ GetLabelObject() [1/3]

template<typename TLabelObject >
LabelObjectType* itk::LabelMap< TLabelObject >::GetLabelObject ( const IndexType idx) const

Return the label object at a given index. This method has a worst case complexity of O(L) where L is the number of lines in the image - use it with care.

◆ GetLabelObject() [2/3]

template<typename TLabelObject >
LabelObjectType* itk::LabelMap< TLabelObject >::GetLabelObject ( const LabelType label)

Return the LabelObject with the label given in parameter. This method throws an exception if the label doesn't exist in this image, or if the label is the background one.

◆ GetLabelObject() [3/3]

template<typename TLabelObject >
const LabelObjectType* itk::LabelMap< TLabelObject >::GetLabelObject ( const LabelType label) const

the LabelObject container type

◆ GetLabelObjects()

template<typename TLabelObject >
LabelObjectVectorType itk::LabelMap< TLabelObject >::GetLabelObjects ( ) const

Return the the label objects available in the label map

◆ GetLabels()

template<typename TLabelObject >
LabelVectorType itk::LabelMap< TLabelObject >::GetLabels ( ) const

Return the labels of the label objects available in the label map

◆ GetNameOfClass()

template<typename TLabelObject >
virtual const char* itk::LabelMap< TLabelObject >::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::ImageBase< TLabelObject::ImageDimension >.

◆ GetNthLabelObject() [1/2]

template<typename TLabelObject >
LabelObjectType* itk::LabelMap< TLabelObject >::GetNthLabelObject ( const SizeValueType pos)

Return the LabelObject with at the position given in parameter. This method can be useful when the labels are not consecutives, but is quite inefficient. This method throws an exception if the index doesn't exist in this image.

◆ GetNthLabelObject() [2/2]

template<typename TLabelObject >
const LabelObjectType* itk::LabelMap< TLabelObject >::GetNthLabelObject ( const SizeValueType pos) const

the LabelObject container type

◆ GetNumberOfLabelObjects()

template<typename TLabelObject >
Self::SizeValueType itk::LabelMap< TLabelObject >::GetNumberOfLabelObjects ( ) const

Return the number of label objects in the image

◆ GetPixel()

template<typename TLabelObject >
const LabelType& itk::LabelMap< TLabelObject >::GetPixel ( const IndexType idx) const

Return the pixel value at a given index in the image. If the given index is contained in several objects, only the smallest label of those objects is returned. This method has a worst case complexity of O(L) where L is the number of lines in the image - use it with care.

◆ Graft() [1/2]

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::Graft ( const DataObject data)
overrideprotectedvirtual

the LabelObject container type

Reimplemented from itk::ImageBase< TLabelObject::ImageDimension >.

◆ Graft() [2/2]

template<typename TLabelObject >
virtual void itk::LabelMap< TLabelObject >::Graft ( const Self image)
virtual

Graft the data and information from one image to another. This is a convenience method to setup a second image with all the meta information of another image and use the same pixel container. Note that this method is different than just using two SmartPointers to the same image since separate DataObjects are still maintained. This method is similar to ImageSource::GraftOutput(). The implementation in ImageBase simply calls CopyInformation() and copies the region ivars. Subclasses of ImageBase are responsible for copying the pixel container.

Reimplemented from itk::ImageBase< TLabelObject::ImageDimension >.

◆ HasLabel()

template<typename TLabelObject >
bool itk::LabelMap< TLabelObject >::HasLabel ( const LabelType  label) const

Return true is the image contains the label given in parameter and false otherwise. If the label is the background one, true is also returned, so this method may not be a good enough test before calling GetLabelObject().

◆ Initialize()

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::Initialize ( )
overridevirtual

Restore the data object to its initial state. This means releasing memory.

Reimplemented from itk::DataObject.

◆ New()

template<typename TLabelObject >
static Pointer itk::LabelMap< TLabelObject >::New ( )
static

Method for creation through the object factory.

◆ Optimize()

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::Optimize ( )

Optimize the line representation of all the label objects referenced in the LabelMap

◆ PrintLabelObjects() [1/2]

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::PrintLabelObjects ( ) const
inline

the LabelObject container type

Definition at line 302 of file itkLabelMap.h.

◆ PrintLabelObjects() [2/2]

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::PrintLabelObjects ( std::ostream &  os) const

Print all the objects stored in that collection - a convenient method for prototyping.

◆ PrintSelf()

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
overrideprotectedvirtual

the LabelObject container type

Reimplemented from itk::DataObject.

◆ PushLabelObject()

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::PushLabelObject ( LabelObjectType labelObject)

Add a label object to the image. The label of the label object is ignored, and a new label is given to the label object.

◆ RemoveLabel()

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::RemoveLabel ( const LabelType label)

Remove a label object.

◆ RemoveLabelObject()

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::RemoveLabelObject ( LabelObjectType labelObject)

Remove a label object.

◆ RemovePixel() [1/2]

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::RemovePixel ( const IndexType idx,
const LabelType label 
)

Remove index idx from the label object which has the label label. If the label object gets empty, it is being removed from the container.

◆ RemovePixel() [2/2]

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::RemovePixel ( const LabelObjectContainerIterator it,
const IndexType idx,
bool  iEmitModifiedEvent 
)
private

the LabelObject container type

◆ SetBackgroundValue()

template<typename TLabelObject >
virtual void itk::LabelMap< TLabelObject >::SetBackgroundValue ( LabelType  _arg)
virtual

the LabelObject container type

◆ SetLine()

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::SetLine ( const IndexType idx,
const LengthType length,
const LabelType label 
)

Set a full line in the image. If no label object has this label in the image, a new object is created. If a label object already exist with that label, the line is added to it WITHOUT any check - it means that if the label object may contain several time the same pixel after have run that method. This method runs in constant time.

◆ SetPixel()

template<typename TLabelObject >
void itk::LabelMap< TLabelObject >::SetPixel ( const IndexType idx,
const LabelType iLabel 
)

Set the pixel value at a given index in the image.

As for itk::Image, this method ensure that the pixel at the position idx has a unique value.

The complexity of this method is at best O(L) where L is the number of lines in the image - usit with care.

Member Data Documentation

◆ ImageDimension

template<typename TLabelObject >
constexpr unsigned int itk::LabelMap< TLabelObject >::ImageDimension = LabelObjectType::ImageDimension
staticconstexpr

Dimension of the image. This constant is used by functions that are templated over image type (as opposed to being templated over pixel type and dimension) when they need compile time access to the dimension of the image.

Definition at line 100 of file itkLabelMap.h.

◆ m_BackgroundValue

template<typename TLabelObject >
LabelType itk::LabelMap< TLabelObject >::m_BackgroundValue
private

the LabelObject container type

Definition at line 513 of file itkLabelMap.h.

◆ m_LabelObjectContainer

template<typename TLabelObject >
LabelObjectContainerType itk::LabelMap< TLabelObject >::m_LabelObjectContainer
private

the LabelObject container type

Definition at line 512 of file itkLabelMap.h.


The documentation for this class was generated from the following file: