Medical Imaging Interaction Toolkit
2024.06.99-c70462f2
Medical Imaging Interaction Toolkit
|
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>
Classes | |
struct | ContourModelVertex |
Represents a single vertex of a contour. More... | |
Public Types | |
using | VertexType = ContourModelVertex |
using | VertexListType = std::deque< VertexType * > |
using | VertexIterator = VertexListType::iterator |
using | ConstVertexIterator = VertexListType::const_iterator |
using | VertexSizeType = VertexListType::size_type |
Public Member Functions | |
mitkClassMacroItkParent (ContourElement, itk::LightObject) | |
Pointer | Clone () const |
ConstVertexIterator | ConstIteratorBegin () const |
Return a const iterator a the front. More... | |
ConstVertexIterator | ConstIteratorEnd () const |
Return a const iterator a the end. More... | |
VertexIterator | IteratorBegin () |
Return an iterator a the front. More... | |
VertexIterator | IteratorEnd () |
Return an iterator a the end. More... | |
ConstVertexIterator | begin () const |
Return a const iterator a the front. For easier support of stl functionality. More... | |
ConstVertexIterator | end () const |
Return a const iterator a the end. For easier support of stl functionality. More... | |
VertexIterator | begin () |
Return an iterator a the front. For easier support of stl functionality. More... | |
VertexIterator | end () |
Return an iterator a the end. For easier support of stl functionality. More... | |
VertexSizeType | GetSize () const |
Returns the number of contained vertices. 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) |
Add a vertex at a given index of the contour. More... | |
void | SetVertexAt (VertexSizeType pointId, const mitk::Point3D &point) |
Set coordinates a given index. More... | |
void | SetVertexAt (VertexSizeType pointId, const VertexType *vertex) |
Set vertex a given index (by copying the values). More... | |
VertexType * | GetVertexAt (VertexSizeType index) |
Returns the vertex a given index. More... | |
const VertexType * | GetVertexAt (VertexSizeType index) const |
VertexType * | GetVertexAt (const mitk::Point3D &point, float eps) |
Returns the approximate nearest vertex a given position in 3D space. More... | |
VertexType * | GetNextControlVertexAt (const mitk::Point3D &point, float eps) |
Returns the next vertex to the approximate nearest vertex of a given position in 3D space. More... | |
VertexType * | GetPreviousControlVertexAt (const mitk::Point3D &point, float eps) |
Returns the previous vertex to the approximate nearest vertex of a given position in 3D space. More... | |
VertexType * | GetControlVertexAt (const mitk::Point3D &point, float eps) |
Returns the approximate nearest control vertex a given posoition in 3D space, if the clicked position is within a specific range. More... | |
VertexSizeType | GetIndex (const VertexType *vertex) const |
Returns the index of the given vertex within the contour. More... | |
const VertexListType * | GetVertexList () const |
Returns the container of the vertices. More... | |
bool | IsEmpty () const |
Returns whether the contour element is empty. More... | |
bool | IsClosed () const |
Returns if the conour is closed or not. More... | |
bool | IsNearContour (const mitk::Point3D &point, float eps) const |
Returns whether a given point is near a contour, according to eps. More... | |
bool | GetLineSegmentForPoint (const mitk::Point3D &point, float eps, mitk::ContourElement::VertexType *previousVertex, mitk::ContourElement::VertexType *nextVertex) const |
bool | GetLineSegmentForPoint (const mitk::Point3D &point, float eps, VertexSizeType &segmentStartIndex, VertexSizeType &segmentEndIndex, mitk::Point3D &closestContourPoint, bool findClosest=true) const |
void | Close () |
Close the contour. Connect first with last element. More... | |
void | Open () |
Open the contour. Disconnect first and last element. More... | |
void | SetClosed (bool isClosed) |
Set the contours IsClosed property. More... | |
void | Concatenate (const mitk::ContourElement *other, bool check) |
Concatenate the contuor with a another contour. All vertices of the other contour will be cloned and added after last vertex. More... | |
bool | RemoveVertex (const VertexType *vertex) |
Remove the given vertex from the container if exists. More... | |
bool | RemoveVertexAt (VertexSizeType index) |
Remove a vertex at given index within the container if exists. More... | |
bool | RemoveVertexAt (const mitk::Point3D &point, double eps) |
Remove the approximate nearest vertex at given position in 3D space if one exists. More... | |
void | Clear () |
Clear the storage container. More... | |
VertexType * | BruteForceGetVertexAt (const mitk::Point3D &point, double eps, bool isControlPoint=false, int offset=0) |
Returns the approximate nearest vertex a given position in 3D space. With the parameter 'isControlPoint', one can decide if any vertex should be returned, or just control vertices. More... | |
int | BruteForceGetVertexIndexAt (const mitk::Point3D &point, double eps, VertexListType verticesList) |
Returns the index of the approximate nearest vertex of a given position in 3D space. More... | |
VertexListType | GetControlVertices () const |
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 () |
Static Public Attributes | |
static const VertexSizeType | NPOS |
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. 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.
Definition at line 36 of file mitkContourElement.h.
using mitk::ContourElement::ConstVertexIterator = VertexListType::const_iterator |
Definition at line 67 of file mitkContourElement.h.
using mitk::ContourElement::VertexIterator = VertexListType::iterator |
Definition at line 66 of file mitkContourElement.h.
using mitk::ContourElement::VertexListType = std::deque<VertexType*> |
Definition at line 65 of file mitkContourElement.h.
using mitk::ContourElement::VertexSizeType = VertexListType::size_type |
Definition at line 68 of file mitkContourElement.h.
Definition at line 64 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.
point | - coordinates in 3D space. |
isControlPoint | - is the vertex a special control point. |
void mitk::ContourElement::AddVertexAtFront | ( | const mitk::Point3D & | point, |
bool | isControlPoint | ||
) |
Add a vertex at the front of the contour.
point | - coordinates in 3D space. |
isControlPoint | - is the vertex a control point. |
VertexIterator mitk::ContourElement::begin | ( | ) |
Return an iterator a the front. For easier support of stl functionality.
ConstVertexIterator mitk::ContourElement::begin | ( | ) | const |
Return a const iterator a the front. For easier support of stl functionality.
VertexType* mitk::ContourElement::BruteForceGetVertexAt | ( | const mitk::Point3D & | point, |
double | eps, | ||
bool | isControlPoint = false , |
||
int | offset = 0 |
||
) |
Returns the approximate nearest vertex a given position in 3D space. With the parameter 'isControlPoint', one can decide if any vertex should be returned, or just control vertices.
point | - query position in 3D space. |
eps | - the error bound for search algorithm. It is an open boundary. |
isControlPoint | |
offset | - a offset to the vertex, e.g. 1 if the next vertex should be returned or -1 for the previous vertex |
int mitk::ContourElement::BruteForceGetVertexIndexAt | ( | const mitk::Point3D & | point, |
double | eps, | ||
VertexListType | verticesList | ||
) |
Returns the index of the approximate nearest vertex of a given position in 3D space.
point | - query position in 3D space. |
eps | - the error bound for search algorithm. It is an open boundary. |
verticesList | - the vertex list to search the index in, either only control vertices or all vertices |
void mitk::ContourElement::Clear | ( | ) |
Clear the storage container.
Pointer mitk::ContourElement::Clone | ( | ) | const |
void mitk::ContourElement::Close | ( | ) |
Close the contour. Connect first with last element.
void mitk::ContourElement::Concatenate | ( | const mitk::ContourElement * | other, |
bool | check | ||
) |
Concatenate the contuor with a another contour. All vertices of the other contour will be cloned and added after last vertex.
other | - the other contour |
check | - set it true to avoid adding of vertices that are already in the source contour |
ConstVertexIterator mitk::ContourElement::ConstIteratorBegin | ( | ) | const |
Return a const iterator a the front.
ConstVertexIterator mitk::ContourElement::ConstIteratorEnd | ( | ) | const |
Return a const iterator a the end.
VertexIterator mitk::ContourElement::end | ( | ) |
Return an iterator a the end. For easier support of stl functionality.
ConstVertexIterator mitk::ContourElement::end | ( | ) | const |
Return a const iterator a the end. For easier support of stl functionality.
VertexType* mitk::ContourElement::GetControlVertexAt | ( | const mitk::Point3D & | point, |
float | eps | ||
) |
Returns the approximate nearest control vertex a given posoition in 3D space, if the clicked position is within a specific range.
point | - query position in 3D space. |
eps | - the error bound for search algorithm. |
VertexListType mitk::ContourElement::GetControlVertices | ( | ) | const |
Returns a list pointing to all vertices that are indicated to be control points.
VertexSizeType mitk::ContourElement::GetIndex | ( | const VertexType * | vertex | ) | const |
Returns the index of the given vertex within the contour.
vertex | - the vertex to be searched. |
bool mitk::ContourElement::GetLineSegmentForPoint | ( | const mitk::Point3D & | point, |
float | eps, | ||
mitk::ContourElement::VertexType * | previousVertex, | ||
mitk::ContourElement::VertexType * | nextVertex | ||
) | const |
Function that searches for the line segment of the contour that is closest to the passed point and close enough (distance between point and line segment <= eps). If such an line segment exist, the starting vertex and closing vertex of the found segment are passed back.
bool mitk::ContourElement::GetLineSegmentForPoint | ( | const mitk::Point3D & | point, |
float | eps, | ||
VertexSizeType & | segmentStartIndex, | ||
VertexSizeType & | segmentEndIndex, | ||
mitk::Point3D & | closestContourPoint, | ||
bool | findClosest = true |
||
) | const |
Overloaded version that offers additional options when searching for the line segment. In contrast to the other version it returns the index of the segment start and end as well as the point on the line segment closest to the passed point. Further one can decide if the function should search for the first segment that is close enough (see eps) or for the segment that is really the closest (findClosest==true).
VertexType* mitk::ContourElement::GetNextControlVertexAt | ( | const mitk::Point3D & | point, |
float | eps | ||
) |
Returns the next vertex to the approximate nearest vertex of a given position in 3D space.
point | - query position in 3D space. |
eps | - the error bound for search algorithm. |
VertexType* mitk::ContourElement::GetPreviousControlVertexAt | ( | const mitk::Point3D & | point, |
float | eps | ||
) |
Returns the previous vertex to the approximate nearest vertex of a given position in 3D space.
point | - query position in 3D space. |
eps | - the error bound for search algorithm. |
VertexSizeType mitk::ContourElement::GetSize | ( | ) | const |
Returns the number of contained vertices.
VertexType* mitk::ContourElement::GetVertexAt | ( | const mitk::Point3D & | point, |
float | eps | ||
) |
Returns the approximate nearest vertex a given position in 3D space.
point | - query position in 3D space. |
eps | - the error bound for search algorithm. |
VertexType* mitk::ContourElement::GetVertexAt | ( | VertexSizeType | index | ) |
Returns the vertex a given index.
index |
const VertexType* mitk::ContourElement::GetVertexAt | ( | VertexSizeType | index | ) | const |
const VertexListType* mitk::ContourElement::GetVertexList | ( | ) | const |
Returns the container of the vertices.
void mitk::ContourElement::InsertVertexAtIndex | ( | const mitk::Point3D & | point, |
bool | isControlPoint, | ||
VertexSizeType | index | ||
) |
Add a vertex at a given index of the contour.
point | - coordinates in 3D space. |
isControlPoint | - is the vertex a special control point. |
index | - the index to be inserted at. |
bool mitk::ContourElement::IsClosed | ( | ) | const |
Returns if the conour is closed or not.
bool mitk::ContourElement::IsEmpty | ( | ) | const |
Returns whether the contour element is empty.
bool mitk::ContourElement::IsNearContour | ( | const mitk::Point3D & | point, |
float | eps | ||
) | const |
Returns whether a given point is near a contour, according to eps.
point | - query position in 3D space. |
eps | - the error bound for search algorithm. |
VertexIterator mitk::ContourElement::IteratorBegin | ( | ) |
Return an iterator a the front.
VertexIterator mitk::ContourElement::IteratorEnd | ( | ) |
Return an iterator a the end.
mitk::ContourElement::mitkClassMacroItkParent | ( | ContourElement | , |
itk::LightObject | |||
) |
|
protected |
|
static |
void mitk::ContourElement::Open | ( | ) |
Open the contour. Disconnect first and last element.
|
protected |
void mitk::ContourElement::RedistributeControlVertices | ( | const VertexType * | vertex, |
int | period | ||
) |
Uniformly redistribute control points with a given period (in number of vertices)
vertex | - the vertex around which the redistribution is done. |
period | - number of vertices between control points. |
bool mitk::ContourElement::RemoveVertex | ( | const VertexType * | vertex | ) |
Remove the given vertex from the container if exists.
vertex | - the vertex to be removed. |
bool mitk::ContourElement::RemoveVertexAt | ( | const mitk::Point3D & | point, |
double | eps | ||
) |
Remove the approximate nearest vertex at given position in 3D space if one exists.
point | - query point in 3D space. |
eps | - error bound for search algorithm. |
bool mitk::ContourElement::RemoveVertexAt | ( | VertexSizeType | index | ) |
Remove a vertex at given index within the container if exists.
index | - the index where the vertex should be removed. |
|
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 contours IsClosed property.
isClosed | - true = closed; false = open; |
void mitk::ContourElement::SetVertexAt | ( | VertexSizeType | pointId, |
const mitk::Point3D & | point | ||
) |
Set coordinates a given index.
pointId | Index of vertex. |
point | Coordinates. |
void mitk::ContourElement::SetVertexAt | ( | VertexSizeType | pointId, |
const VertexType * | vertex | ||
) |
Set vertex a given index (by copying the values).
pointId | Index of vertex. |
vertex | Vertex. |
|
protected |
Definition at line 304 of file mitkContourElement.h.
|
protected |
Definition at line 303 of file mitkContourElement.h.
|
static |
Indicates an invalid index. It is always the maximum of the unsigned int type.
Definition at line 72 of file mitkContourElement.h.