Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitk::ContourElement Class Reference

Represents a contour in 3D space. A ContourElement is consisting of linked vertices implicitely defining the contour. They are stored in a double ended queue making it possible to add vertices at front and end of the contour and to iterate in both directions. To mark a vertex as a special one it can be set as a control point. More...

#include <mitkContourElement.h>

Inheritance diagram for mitk::ContourElement:
Collaboration diagram for mitk::ContourElement:

Classes

struct  ContourModelVertex
 Represents a single vertex of contour. More...
 

Public Types

typedef ContourModelVertex VertexType
 
typedef std::deque< VertexType * > VertexListType
 
typedef VertexListType::iterator VertexIterator
 
typedef VertexListType::const_iterator ConstVertexIterator
 

Public Member Functions

 mitkClassMacroItkParent (ContourElement, itk::LightObject)
 
Pointer Clone () const
 
virtual ConstVertexIterator ConstIteratorBegin ()
 Return a const iterator a the front. More...
 
virtual ConstVertexIterator ConstIteratorEnd ()
 Return a const iterator a the end. More...
 
virtual VertexIterator IteratorBegin ()
 Return an iterator a the front. More...
 
virtual VertexIterator IteratorEnd ()
 Return an iterator a the end. More...
 
virtual int GetSize ()
 Returns the number of contained vertices. More...
 
virtual void AddVertex (mitk::Point3D &point, bool isControlPoint)
 Add a vertex at the end of the contour. More...
 
virtual void AddVertex (VertexType &vertex)
 Add a vertex at the end of the contour. More...
 
virtual void AddVertexAtFront (mitk::Point3D &point, bool isControlPoint)
 Add a vertex at the front of the contour. More...
 
virtual void AddVertexAtFront (VertexType &vertex)
 Add a vertex at the front of the contour. More...
 
virtual void InsertVertexAtIndex (mitk::Point3D &point, bool isControlPoint, int index)
 Add a vertex at a given index of the contour. More...
 
virtual void SetVertexAt (int pointId, const mitk::Point3D &point)
 Set coordinates a given index. More...
 
virtual void SetVertexAt (int pointId, const VertexType *vertex)
 Set vertex a given index. More...
 
virtual VertexTypeGetVertexAt (int index)
 Returns the vertex a given index. More...
 
virtual VertexTypeGetVertexAt (const mitk::Point3D &point, float eps)
 Returns the approximate nearest vertex a given posoition in 3D space. More...
 
virtual int GetIndex (const VertexType *vertex)
 Returns the index of the given vertex within the contour. More...
 
VertexListTypeGetVertexList ()
 Returns the container of the vertices. More...
 
bool IsEmpty ()
 Returns whether the contour element is empty. More...
 
virtual bool IsClosed ()
 Returns if the conour is closed or not. More...
 
virtual bool IsNearContour (const mitk::Point3D &point, float eps)
 Returns whether a given point is near a contour, according to eps. More...
 
virtual void Close ()
 Close the contour. Connect first with last element. More...
 
virtual void Open ()
 Open the contour. Disconnect first and last element. More...
 
virtual void SetClosed (bool isClosed)
 Set the contours IsClosed property. More...
 
void Concatenate (mitk::ContourElement *other, bool check)
 Concatenate the contuor with a another contour. All vertices of the other contour will be added after last vertex. More...
 
virtual bool RemoveVertex (const VertexType *vertex)
 Remove the given vertex from the container if exists. More...
 
virtual bool RemoveVertexAt (int index)
 Remove a vertex at given index within the container if exists. More...
 
virtual bool RemoveVertexAt (mitk::Point3D &point, float eps)
 Remove the approximate nearest vertex at given position in 3D space if one exists. More...
 
virtual void Clear ()
 Clear the storage container. More...
 
VertexTypeBruteForceGetVertexAt (const mitk::Point3D &point, float eps)
 Returns the approximate nearest vertex a given posoition in 3D space. More...
 
VertexListTypeGetControlVertices ()
 Returns the approximate nearest vertex a given posoition in 3D space. More...
 
void RedistributeControlVertices (const VertexType *vertex, int period)
 Uniformly redistribute control points with a given period (in number of vertices) More...
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 mitkCloneMacro (Self)
 
 ContourElement ()
 
 ContourElement (const mitk::ContourElement &other)
 
 ~ContourElement () override
 

Protected Attributes

VertexListTypem_Vertices
 
bool m_IsClosed
 

Detailed Description

Represents a contour in 3D space. A ContourElement is consisting of linked vertices implicitely defining the contour. They are stored in a double ended queue making it possible to add vertices at front and end of the contour and to iterate in both directions. To mark a vertex as a special one it can be set as a control point.

It is highly not recommend to use this class directly as no secure mechanism is used here. Use mitk::ContourModel instead providing some additional features.

Definition at line 34 of file mitkContourElement.h.

Member Typedef Documentation

◆ ConstVertexIterator

typedef VertexListType::const_iterator mitk::ContourElement::ConstVertexIterator

Definition at line 66 of file mitkContourElement.h.

◆ VertexIterator

typedef VertexListType::iterator mitk::ContourElement::VertexIterator

Definition at line 65 of file mitkContourElement.h.

◆ VertexListType

Definition at line 64 of file mitkContourElement.h.

◆ VertexType

Constructor & Destructor Documentation

◆ ContourElement() [1/2]

mitk::ContourElement::ContourElement ( )
protected

Definition at line 16 of file mitkContourElement.cpp.

References m_IsClosed, and m_Vertices.

◆ ContourElement() [2/2]

mitk::ContourElement::ContourElement ( const mitk::ContourElement other)
protected

Definition at line 22 of file mitkContourElement.cpp.

◆ ~ContourElement()

mitk::ContourElement::~ContourElement ( )
overrideprotected

Definition at line 27 of file mitkContourElement.cpp.

References m_Vertices.

Member Function Documentation

◆ AddVertex() [1/2]

void mitk::ContourElement::AddVertex ( mitk::Point3D point,
bool  isControlPoint 
)
virtual

Add a vertex at the end of the contour.

Parameters
point- coordinates in 3D space.
isControlPoint- is the vertex a special control point.

Definition at line 32 of file mitkContourElement.cpp.

References m_Vertices.

◆ AddVertex() [2/2]

void mitk::ContourElement::AddVertex ( VertexType vertex)
virtual

Add a vertex at the end of the contour.

Parameters
vertex- a contour element vertex.

Definition at line 37 of file mitkContourElement.cpp.

References m_Vertices.

◆ AddVertexAtFront() [1/2]

void mitk::ContourElement::AddVertexAtFront ( mitk::Point3D point,
bool  isControlPoint 
)
virtual

Add a vertex at the front of the contour.

Parameters
point- coordinates in 3D space.
isControlPoint- is the vertex a control point.

Definition at line 42 of file mitkContourElement.cpp.

References m_Vertices.

◆ AddVertexAtFront() [2/2]

void mitk::ContourElement::AddVertexAtFront ( VertexType vertex)
virtual

Add a vertex at the front of the contour.

Parameters
vertex- a contour element vertex.

Definition at line 47 of file mitkContourElement.cpp.

References m_Vertices.

◆ BruteForceGetVertexAt()

mitk::ContourElement::VertexType * mitk::ContourElement::BruteForceGetVertexAt ( const mitk::Point3D point,
float  eps 
)

Returns the approximate nearest vertex a given posoition in 3D space.

Parameters
point- query position in 3D space.
eps- the error bound for search algorithm.

Definition at line 101 of file mitkContourElement.cpp.

References m_Vertices.

Referenced by GetVertexAt().

◆ Clear()

void mitk::ContourElement::Clear ( )
virtual

Clear the storage container.

Definition at line 429 of file mitkContourElement.cpp.

References m_Vertices.

◆ Clone()

Pointer mitk::ContourElement::Clone ( ) const

◆ Close()

void mitk::ContourElement::Close ( )
virtual

Close the contour. Connect first with last element.

Definition at line 274 of file mitkContourElement.cpp.

References m_IsClosed.

Referenced by SetClosed().

◆ Concatenate()

void mitk::ContourElement::Concatenate ( mitk::ContourElement other,
bool  check 
)

Concatenate the contuor with a another contour. All vertices of the other contour will be added after last vertex.

Parameters
other- the other contour
check- set it true to avoid intersections

Definition at line 308 of file mitkContourElement.cpp.

References GetSize(), and m_Vertices.

◆ ConstIteratorBegin()

virtual ConstVertexIterator mitk::ContourElement::ConstIteratorBegin ( )
inlinevirtual

Return a const iterator a the front.

Definition at line 72 of file mitkContourElement.h.

◆ ConstIteratorEnd()

virtual ConstVertexIterator mitk::ContourElement::ConstIteratorEnd ( )
inlinevirtual

Return a const iterator a the end.

Definition at line 75 of file mitkContourElement.h.

◆ GetControlVertices()

mitk::ContourElement::VertexListType * mitk::ContourElement::GetControlVertices ( )

Returns the approximate nearest vertex a given posoition in 3D space.

Parameters
point- query position in 3D space.
eps- the error bound for search algorithm.

Definition at line 289 of file mitkContourElement.cpp.

References m_Vertices.

◆ GetIndex()

int mitk::ContourElement::GetIndex ( const VertexType vertex)
virtual

Returns the index of the given vertex within the contour.

Parameters
vertex- the vertex to be searched.
Returns
index of vertex. -1 if not found.

Definition at line 365 of file mitkContourElement.cpp.

References m_Vertices.

◆ GetSize()

virtual int mitk::ContourElement::GetSize ( )
inlinevirtual

Returns the number of contained vertices.

Definition at line 84 of file mitkContourElement.h.

References mitk::eps, and mitkCloneMacro.

Referenced by Concatenate(), InsertVertexAtIndex(), and SetVertexAt().

◆ GetVertexAt() [1/2]

mitk::ContourElement::VertexType * mitk::ContourElement::GetVertexAt ( int  index)
virtual

Returns the vertex a given index.

Parameters
index

Definition at line 79 of file mitkContourElement.cpp.

References m_Vertices.

◆ GetVertexAt() [2/2]

mitk::ContourElement::VertexType * mitk::ContourElement::GetVertexAt ( const mitk::Point3D point,
float  eps 
)
virtual

Returns the approximate nearest vertex a given posoition in 3D space.

Parameters
point- query position in 3D space.
eps- the error bound for search algorithm.

Definition at line 89 of file mitkContourElement.cpp.

References BruteForceGetVertexAt().

◆ GetVertexList()

mitk::ContourElement::VertexListType * mitk::ContourElement::GetVertexList ( )

Returns the container of the vertices.

Definition at line 220 of file mitkContourElement.cpp.

References m_Vertices.

◆ InsertVertexAtIndex()

void mitk::ContourElement::InsertVertexAtIndex ( mitk::Point3D point,
bool  isControlPoint,
int  index 
)
virtual

Add a vertex at a given index of the contour.

Parameters
point- coordinates in 3D space.
isControlPoint- is the vertex a special control point.
index- the index to be inserted at.

Definition at line 52 of file mitkContourElement.cpp.

References GetSize(), and m_Vertices.

◆ IsClosed()

bool mitk::ContourElement::IsClosed ( )
virtual

Returns if the conour is closed or not.

Definition at line 225 of file mitkContourElement.cpp.

References m_IsClosed.

◆ IsEmpty()

bool mitk::ContourElement::IsEmpty ( )

Returns whether the contour element is empty.

Definition at line 84 of file mitkContourElement.cpp.

References m_Vertices.

◆ IsNearContour()

bool mitk::ContourElement::IsNearContour ( const mitk::Point3D point,
float  eps 
)
virtual

Returns whether a given point is near a contour, according to eps.

Parameters
point- query position in 3D space.
eps- the error bound for search algorithm.

Definition at line 230 of file mitkContourElement.cpp.

References m_Vertices.

◆ IteratorBegin()

virtual VertexIterator mitk::ContourElement::IteratorBegin ( )
inlinevirtual

Return an iterator a the front.

Definition at line 78 of file mitkContourElement.h.

◆ IteratorEnd()

virtual VertexIterator mitk::ContourElement::IteratorEnd ( )
inlinevirtual

Return an iterator a the end.

Definition at line 81 of file mitkContourElement.h.

◆ mitkClassMacroItkParent()

mitk::ContourElement::mitkClassMacroItkParent ( ContourElement  ,
itk::LightObject   
)

◆ mitkCloneMacro()

mitk::ContourElement::mitkCloneMacro ( Self  )
protected

◆ New()

static Pointer mitk::ContourElement::New ( )
static

◆ Open()

void mitk::ContourElement::Open ( )
virtual

Open the contour. Disconnect first and last element.

Definition at line 279 of file mitkContourElement.cpp.

References m_IsClosed.

Referenced by SetClosed().

◆ RedistributeControlVertices()

void mitk::ContourElement::RedistributeControlVertices ( const VertexType vertex,
int  period 
)

Uniformly redistribute control points with a given period (in number of vertices)

Parameters
vertex- the vertex around which the redistribution is done.
period- number of vertices between control points.

Definition at line 434 of file mitkContourElement.cpp.

References m_Vertices.

◆ RemoveVertex()

bool mitk::ContourElement::RemoveVertex ( const VertexType vertex)
virtual

Remove the given vertex from the container if exists.

Parameters
vertex- the vertex to be removed.

Definition at line 344 of file mitkContourElement.cpp.

References m_Vertices.

◆ RemoveVertexAt() [1/2]

bool mitk::ContourElement::RemoveVertexAt ( int  index)
virtual

Remove a vertex at given index within the container if exists.

Parameters
index- the index where the vertex should be removed.

Definition at line 388 of file mitkContourElement.cpp.

References m_Vertices.

◆ RemoveVertexAt() [2/2]

bool mitk::ContourElement::RemoveVertexAt ( mitk::Point3D point,
float  eps 
)
virtual

Remove the approximate nearest vertex at given position in 3D space if one exists.

Parameters
point- query point in 3D space.
eps- error bound for search algorithm.

Definition at line 401 of file mitkContourElement.cpp.

References mitk::eps, and m_Vertices.

◆ SetClosed()

void mitk::ContourElement::SetClosed ( bool  isClosed)
virtual

Set the contours IsClosed property.

Parameters
isClosed- true = closed; false = open;

Definition at line 284 of file mitkContourElement.cpp.

References Close(), and Open().

◆ SetVertexAt() [1/2]

void mitk::ContourElement::SetVertexAt ( int  pointId,
const mitk::Point3D point 
)
virtual

Set coordinates a given index.

Parameters
pointIdIndex of vertex.
pointCoordinates.

Definition at line 62 of file mitkContourElement.cpp.

References GetSize(), and m_Vertices.

◆ SetVertexAt() [2/2]

void mitk::ContourElement::SetVertexAt ( int  pointId,
const VertexType vertex 
)
virtual

Set vertex a given index.

Parameters
pointIdIndex of vertex.
vertexVertex.

Definition at line 70 of file mitkContourElement.cpp.

References mitk::ContourElement::ContourModelVertex::Coordinates, GetSize(), mitk::ContourElement::ContourModelVertex::IsControlPoint, and m_Vertices.

Member Data Documentation

◆ m_IsClosed

bool mitk::ContourElement::m_IsClosed
protected

Definition at line 233 of file mitkContourElement.h.

Referenced by Close(), ContourElement(), IsClosed(), and Open().

◆ m_Vertices


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