|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Represents a contour in 3D space as a sequence of linked vertices. More...
#include <mitkContourElement.h>


Classes | |
| struct | ContourModelVertex |
| Represents a single vertex of a contour. More... | |
Public Types | |
| using | VertexType = ContourModelVertex |
| Alias for the vertex type used in this contour. More... | |
| using | VertexListType = std::deque< VertexType * > |
| Alias for the container type storing vertex pointers. More... | |
| using | VertexIterator = VertexListType::iterator |
| Mutable iterator for traversing vertices. More... | |
| using | ConstVertexIterator = VertexListType::const_iterator |
| Const iterator for traversing vertices. More... | |
| using | VertexSizeType = VertexListType::size_type |
| Size type for indexing into the vertex list. More... | |
Public Member Functions | |
| mitkClassMacroItkParent (ContourElement, itk::LightObject) | |
| Pointer | Clone () const |
| ConstVertexIterator | ConstIteratorBegin () const |
| Return a const iterator to the first vertex. More... | |
| ConstVertexIterator | ConstIteratorEnd () const |
| Return a const iterator past the last vertex. More... | |
| VertexIterator | IteratorBegin () |
| Return a mutable iterator to the first vertex. More... | |
| VertexIterator | IteratorEnd () |
| Return a mutable iterator past the last vertex. More... | |
| ConstVertexIterator | begin () const |
| Return a const iterator to the first vertex (STL-compatible). More... | |
| ConstVertexIterator | end () const |
| Return a const iterator past the last vertex (STL-compatible). More... | |
| VertexIterator | begin () |
| Return a mutable iterator to the first vertex (STL-compatible). More... | |
| VertexIterator | end () |
| Return a mutable iterator past the last vertex (STL-compatible). More... | |
| VertexSizeType | GetSize () const |
| Return the number of vertices in this contour element. More... | |
| void | AddVertex (const mitk::Point3D &point, bool isControlPoint) |
| Add a vertex at the end of the contour. More... | |
| void | AddVertexAtFront (const mitk::Point3D &point, bool isControlPoint) |
| Add a vertex at the front of the contour. More... | |
| void | InsertVertexAtIndex (const mitk::Point3D &point, bool isControlPoint, VertexSizeType index) |
| Insert a vertex at the given index in the contour. More... | |
| void | SetVertexAt (VertexSizeType pointId, const mitk::Point3D &point) |
| Set the coordinates of an existing vertex at the given index. More... | |
| void | SetVertexAt (VertexSizeType pointId, const VertexType *vertex) |
| Set the vertex data at a given index by copying from the provided vertex. More... | |
| VertexType * | GetVertexAt (VertexSizeType index) |
| Return the vertex at the given index. More... | |
| const VertexType * | GetVertexAt (VertexSizeType index) const |
| Return the vertex at the given index (const version). More... | |
| VertexType * | GetVertexAt (const mitk::Point3D &point, float eps) |
| Find the nearest vertex to a given 3D position within a search radius. More... | |
| VertexType * | GetNextControlVertexAt (const mitk::Point3D &point, float eps) |
| Return the next control vertex after the nearest vertex to a given 3D position. More... | |
| VertexType * | GetPreviousControlVertexAt (const mitk::Point3D &point, float eps) |
| Return the previous control vertex before the nearest vertex to a given 3D position. More... | |
| VertexType * | GetControlVertexAt (const mitk::Point3D &point, float eps) |
| Find the nearest control vertex to a given 3D position within a search radius. More... | |
| VertexSizeType | GetIndex (const VertexType *vertex) const |
| Return the index of a given vertex within the contour. More... | |
| const VertexListType * | GetVertexList () const |
| Return a pointer to the internal vertex container. More... | |
| bool | IsEmpty () const |
| Check whether the contour element contains no vertices. More... | |
| bool | IsClosed () const |
| Check whether the contour is closed. More... | |
| bool | IsNearContour (const mitk::Point3D &point, float eps) const |
| Check whether a given point lies near the contour within a specified tolerance. More... | |
| bool | GetLineSegmentForPoint (const mitk::Point3D &point, float eps, mitk::ContourElement::VertexType *previousVertex, mitk::ContourElement::VertexType *nextVertex) const |
| Find the contour line segment closest to a given point. More... | |
| bool | GetLineSegmentForPoint (const mitk::Point3D &point, float eps, VertexSizeType &segmentStartIndex, VertexSizeType &segmentEndIndex, mitk::Point3D &closestContourPoint, bool findClosest=true) const |
| Find the contour line segment closest to a given point (extended version). More... | |
| void | Close () |
| Close the contour by logically connecting the last vertex to the first. More... | |
| void | Open () |
| Open the contour by removing the logical connection between last and first vertex. More... | |
| void | SetClosed (bool isClosed) |
| Set the closed state of the contour. More... | |
| void | Concatenate (const mitk::ContourElement *other, bool check) |
| Append all vertices of another contour to the end of this contour. More... | |
| bool | RemoveVertex (const VertexType *vertex) |
| Remove a specific vertex from the contour by pointer identity. More... | |
| bool | RemoveVertexAt (VertexSizeType index) |
| Remove the vertex at a given index. More... | |
| bool | RemoveVertexAt (const mitk::Point3D &point, double eps) |
| Remove the nearest vertex to a given 3D position within a search radius. More... | |
| void | Clear () |
| Remove all vertices from the contour and free their memory. More... | |
| VertexType * | BruteForceGetVertexAt (const mitk::Point3D &point, double eps, bool isControlPoint=false, int offset=0) |
| Find the nearest vertex to a given 3D position using brute-force search. More... | |
| int | BruteForceGetVertexIndexAt (const mitk::Point3D &point, double eps, VertexListType verticesList) |
| Find the index of the nearest vertex to a given 3D position using brute-force search. More... | |
| VertexListType | GetControlVertices () const |
| Return a list of all vertices that are marked as control points. More... | |
| void | RedistributeControlVertices (const VertexType *vertex, int period) |
| Uniformly redistribute control point markers among the vertices. More... | |
Static Public Member Functions | |
| static Pointer | New () |
Static Public Attributes | |
| static const VertexSizeType | NPOS |
| Sentinel value indicating an invalid vertex index. More... | |
Protected Member Functions | |
| mitkCloneMacro (Self) | |
| ContourElement ()=default | |
| ContourElement (const mitk::ContourElement &other) | |
| ~ContourElement () | |
| ContourElement & | operator= (const ContourElement &other) |
| bool | RemoveVertexByIterator (VertexListType::iterator &iter) |
Protected Attributes | |
| VertexListType | m_Vertices |
| bool | m_IsClosed |
Represents a contour in 3D space as a sequence of linked vertices.
A ContourElement consists of linked vertices that implicitly define a contour. The vertices are stored in a double-ended queue (std::deque), making it possible to add vertices at the front and end of the contour and to iterate in both directions. Individual vertices can be marked as control points to distinguish them from regular interpolation points.
This class owns all its vertices. When a vertex is added, ownership is transferred to this ContourElement instance, which manages deletion.
Definition at line 41 of file mitkContourElement.h.
| using mitk::ContourElement::ConstVertexIterator = VertexListType::const_iterator |
Const iterator for traversing vertices.
Definition at line 96 of file mitkContourElement.h.
| using mitk::ContourElement::VertexIterator = VertexListType::iterator |
Mutable iterator for traversing vertices.
Definition at line 94 of file mitkContourElement.h.
| using mitk::ContourElement::VertexListType = std::deque<VertexType*> |
Alias for the container type storing vertex pointers.
Definition at line 92 of file mitkContourElement.h.
| using mitk::ContourElement::VertexSizeType = VertexListType::size_type |
Size type for indexing into the vertex list.
Definition at line 98 of file mitkContourElement.h.
Alias for the vertex type used in this contour.
Definition at line 90 of file mitkContourElement.h.
|
protecteddefault |
|
protected |
|
protected |
| void mitk::ContourElement::AddVertex | ( | const mitk::Point3D & | point, |
| bool | isControlPoint | ||
| ) |
Add a vertex at the end of the contour.
| [in] | point | Coordinates of the new vertex in 3D space. |
| [in] | isControlPoint | If true, the vertex is marked as a control point. |
| void mitk::ContourElement::AddVertexAtFront | ( | const mitk::Point3D & | point, |
| bool | isControlPoint | ||
| ) |
Add a vertex at the front of the contour.
| [in] | point | Coordinates of the new vertex in 3D space. |
| [in] | isControlPoint | If true, the vertex is marked as a control point. |
| VertexIterator mitk::ContourElement::begin | ( | ) |
Return a mutable iterator to the first vertex (STL-compatible).
| ConstVertexIterator mitk::ContourElement::begin | ( | ) | const |
Return a const iterator to the first vertex (STL-compatible).
| VertexType* mitk::ContourElement::BruteForceGetVertexAt | ( | const mitk::Point3D & | point, |
| double | eps, | ||
| bool | isControlPoint = false, |
||
| int | offset = 0 |
||
| ) |
Find the nearest vertex to a given 3D position using brute-force search.
Optionally filters for control points only and supports returning a vertex at an offset from the nearest match (e.g., +1 for the next, -1 for the previous). Wrapping is applied if the offset goes past either end of the list.
| [in] | point | Query position in 3D space. |
| [in] | eps | Maximum Euclidean distance (open boundary). Must be >= 0. |
| [in] | isControlPoint | If true, only control vertices are considered. Default is false. |
| [in] | offset | Index offset from the nearest vertex. Default is 0 (return the nearest). |
| int mitk::ContourElement::BruteForceGetVertexIndexAt | ( | const mitk::Point3D & | point, |
| double | eps, | ||
| VertexListType | verticesList | ||
| ) |
Find the index of the nearest vertex to a given 3D position using brute-force search.
| [in] | point | Query position in 3D space. |
| [in] | eps | Maximum Euclidean distance (open boundary). Must be >= 0. |
| [in] | verticesList | The vertex list to search (may be a subset, e.g., only control vertices). |
| mitk::Exception | if eps is negative. |
| void mitk::ContourElement::Clear | ( | ) |
Remove all vertices from the contour and free their memory.
| Pointer mitk::ContourElement::Clone | ( | ) | const |
| void mitk::ContourElement::Close | ( | ) |
Close the contour by logically connecting the last vertex to the first.
| void mitk::ContourElement::Concatenate | ( | const mitk::ContourElement * | other, |
| bool | check | ||
| ) |
Append all vertices of another contour to the end of this contour.
All vertices from other are cloned and appended after the last vertex of this contour.
| [in] | other | The contour whose vertices are to be appended. |
| [in] | check | If true, vertices whose coordinates already exist in this contour are skipped to avoid duplicates. |
| ConstVertexIterator mitk::ContourElement::ConstIteratorBegin | ( | ) | const |
Return a const iterator to the first vertex.
| ConstVertexIterator mitk::ContourElement::ConstIteratorEnd | ( | ) | const |
Return a const iterator past the last vertex.
| VertexIterator mitk::ContourElement::end | ( | ) |
Return a mutable iterator past the last vertex (STL-compatible).
| ConstVertexIterator mitk::ContourElement::end | ( | ) | const |
Return a const iterator past the last vertex (STL-compatible).
| VertexType* mitk::ContourElement::GetControlVertexAt | ( | const mitk::Point3D & | point, |
| float | eps | ||
| ) |
Find the nearest control vertex to a given 3D position within a search radius.
| [in] | point | Query position in 3D space. |
| [in] | eps | Maximum Euclidean distance for a control vertex to be considered a match. |
| VertexListType mitk::ContourElement::GetControlVertices | ( | ) | const |
Return a list of all vertices that are marked as control points.
The returned list contains pointers to the internally stored vertices. The ContourElement retains ownership of the vertices; callers must clone any vertices they wish to manage independently.
| VertexSizeType mitk::ContourElement::GetIndex | ( | const VertexType * | vertex | ) | const |
Return the index of a given vertex within the contour.
| [in] | vertex | Pointer to the vertex to search for (by pointer identity). |
| bool mitk::ContourElement::GetLineSegmentForPoint | ( | const mitk::Point3D & | point, |
| float | eps, | ||
| mitk::ContourElement::VertexType * | previousVertex, | ||
| mitk::ContourElement::VertexType * | nextVertex | ||
| ) | const |
Find the contour line segment closest to a given point.
Searches for the line segment whose distance to point is at most eps. If found, the start and end vertices of the segment are written to previousVertex and nextVertex.
| [in] | point | Query position in 3D space. |
| [in] | eps | Maximum squared distance for a segment to be considered close enough. |
| [out] | previousVertex | Receives the start vertex of the found segment. |
| [out] | nextVertex | Receives the end vertex of the found segment. |
previousVertex and nextVertex are only valid when the return value is true. | bool mitk::ContourElement::GetLineSegmentForPoint | ( | const mitk::Point3D & | point, |
| float | eps, | ||
| VertexSizeType & | segmentStartIndex, | ||
| VertexSizeType & | segmentEndIndex, | ||
| mitk::Point3D & | closestContourPoint, | ||
| bool | findClosest = true |
||
| ) | const |
Find the contour line segment closest to a given point (extended version).
In addition to the basic version, this overload returns the indices of the segment endpoints, the closest point on the segment, and supports choosing between the first close-enough segment or the globally closest segment.
| [in] | point | Query position in 3D space. |
| [in] | eps | Maximum squared distance for a segment to be considered close enough. |
| [out] | segmentStartIndex | Index of the segment's start vertex. |
| [out] | segmentEndIndex | Index of the segment's end vertex. |
| [out] | closestContourPoint | The point on the segment closest to point. |
| [in] | findClosest | If true, finds the globally closest segment; if false, returns the first segment within eps. Default is true. |
| VertexType* mitk::ContourElement::GetNextControlVertexAt | ( | const mitk::Point3D & | point, |
| float | eps | ||
| ) |
Return the next control vertex after the nearest vertex to a given 3D position.
| [in] | point | Query position in 3D space. |
| [in] | eps | Maximum Euclidean distance for the initial nearest vertex search. |
| VertexType* mitk::ContourElement::GetPreviousControlVertexAt | ( | const mitk::Point3D & | point, |
| float | eps | ||
| ) |
Return the previous control vertex before the nearest vertex to a given 3D position.
| [in] | point | Query position in 3D space. |
| [in] | eps | Maximum Euclidean distance for the initial nearest vertex search. |
| VertexSizeType mitk::ContourElement::GetSize | ( | ) | const |
Return the number of vertices in this contour element.
| VertexType* mitk::ContourElement::GetVertexAt | ( | const mitk::Point3D & | point, |
| float | eps | ||
| ) |
Find the nearest vertex to a given 3D position within a search radius.
| [in] | point | Query position in 3D space. |
| [in] | eps | Maximum Euclidean distance for a vertex to be considered a match. |
| VertexType* mitk::ContourElement::GetVertexAt | ( | VertexSizeType | index | ) |
Return the vertex at the given index.
| [in] | index | Index of the vertex to retrieve. |
index must be a valid index (< GetSize()). | std::out_of_range | if the index is out of bounds. |
| const VertexType* mitk::ContourElement::GetVertexAt | ( | VertexSizeType | index | ) | const |
Return the vertex at the given index (const version).
| [in] | index | Index of the vertex to retrieve. |
index must be a valid index (< GetSize()). | std::out_of_range | if the index is out of bounds. |
| const VertexListType* mitk::ContourElement::GetVertexList | ( | ) | const |
Return a pointer to the internal vertex container.
| void mitk::ContourElement::InsertVertexAtIndex | ( | const mitk::Point3D & | point, |
| bool | isControlPoint, | ||
| VertexSizeType | index | ||
| ) |
Insert a vertex at the given index in the contour.
If the index equals or exceeds the current size, the vertex is appended.
| [in] | point | Coordinates of the new vertex in 3D space. |
| [in] | isControlPoint | If true, the vertex is marked as a control point. |
| [in] | index | Position at which the vertex is inserted. |
| bool mitk::ContourElement::IsClosed | ( | ) | const |
Check whether the contour is closed.
| bool mitk::ContourElement::IsEmpty | ( | ) | const |
Check whether the contour element contains no vertices.
| bool mitk::ContourElement::IsNearContour | ( | const mitk::Point3D & | point, |
| float | eps | ||
| ) | const |
Check whether a given point lies near the contour within a specified tolerance.
| [in] | point | Query position in 3D space. |
| [in] | eps | Maximum squared distance for the point to be considered near the contour. |
| VertexIterator mitk::ContourElement::IteratorBegin | ( | ) |
Return a mutable iterator to the first vertex.
| VertexIterator mitk::ContourElement::IteratorEnd | ( | ) |
Return a mutable iterator past the last vertex.
| mitk::ContourElement::mitkClassMacroItkParent | ( | ContourElement | , |
| itk::LightObject | |||
| ) |
|
protected |
|
static |
| void mitk::ContourElement::Open | ( | ) |
Open the contour by removing the logical connection between last and first vertex.
|
protected |
| void mitk::ContourElement::RedistributeControlVertices | ( | const VertexType * | vertex, |
| int | period | ||
| ) |
Uniformly redistribute control point markers among the vertices.
Starting from vertex (or the first vertex if nullptr), marks every period-th vertex as a control point and clears the flag on all others.
| [in] | vertex | The vertex around which redistribution is centered. May be nullptr. |
| [in] | period | Number of vertices between successive control points. |
| bool mitk::ContourElement::RemoveVertex | ( | const VertexType * | vertex | ) |
Remove a specific vertex from the contour by pointer identity.
| [in] | vertex | Pointer to the vertex to remove. |
| bool mitk::ContourElement::RemoveVertexAt | ( | const mitk::Point3D & | point, |
| double | eps | ||
| ) |
Remove the nearest vertex to a given 3D position within a search radius.
| [in] | point | Query position in 3D space. |
| [in] | eps | Maximum Euclidean distance for a vertex to be considered a match. |
| bool mitk::ContourElement::RemoveVertexAt | ( | VertexSizeType | index | ) |
Remove the vertex at a given index.
| [in] | index | Index of the vertex to remove. |
|
protected |
Internal helper function to correctly remove the element indicated by the iterator from the list. After the call the iterator is invalid. Caller of the function must ensure that the iterator is valid!.
| void mitk::ContourElement::SetClosed | ( | bool | isClosed | ) |
Set the closed state of the contour.
| [in] | isClosed | If true, the contour is closed; if false, it is opened. |
| void mitk::ContourElement::SetVertexAt | ( | VertexSizeType | pointId, |
| const mitk::Point3D & | point | ||
| ) |
Set the coordinates of an existing vertex at the given index.
| [in] | pointId | Index of the vertex to modify. |
| [in] | point | New 3D coordinates. |
| void mitk::ContourElement::SetVertexAt | ( | VertexSizeType | pointId, |
| const VertexType * | vertex | ||
| ) |
Set the vertex data at a given index by copying from the provided vertex.
| [in] | pointId | Index of the vertex to modify. |
| [in] | vertex | Source vertex whose coordinates and control point flag are copied. |
vertex must be a valid (non-null) pointer. | mitk::Exception | if vertex is nullptr. |
|
protected |
Definition at line 407 of file mitkContourElement.h.
|
protected |
Definition at line 406 of file mitkContourElement.h.
|
static |
Sentinel value indicating an invalid vertex index.
Equivalent to the maximum value of the unsigned size type.
Definition at line 104 of file mitkContourElement.h.