12 #ifndef mitkContourElement_h
13 #define mitkContourElement_h
46 itkFactorylessNewMacro(Self);
68 : IsControlPoint(other.IsControlPoint), Coordinates(other.Coordinates)
407 bool m_IsClosed =
false;
#define MITKCONTOURMODEL_EXPORT
Represents a contour in 3D space as a sequence of linked vertices.
ConstVertexIterator ConstIteratorBegin() const
Return a const iterator to the first vertex.
VertexListType::const_iterator ConstVertexIterator
Const iterator for traversing vertices.
void Concatenate(const mitk::ContourElement *other, bool check)
Append all vertices of another contour to the end of this contour.
bool IsEmpty() const
Check whether the contour element contains no vertices.
const VertexType * GetVertexAt(VertexSizeType index) const
Return the vertex at the given index (const version).
VertexListType m_Vertices
bool IsNearContour(const mitk::Point3D &point, float eps) const
Check whether a given point lies near the contour within a specified tolerance.
ConstVertexIterator begin() const
Return a const iterator to the first vertex (STL-compatible).
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.
VertexIterator end()
Return a mutable iterator past the last vertex (STL-compatible).
VertexListType::iterator VertexIterator
Mutable iterator for traversing vertices.
VertexType * GetControlVertexAt(const mitk::Point3D &point, float eps)
Find the nearest control vertex to a given 3D position within a search radius.
std::deque< VertexType * > VertexListType
Alias for the container type storing vertex pointers.
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.
void AddVertex(const mitk::Point3D &point, bool isControlPoint)
Add a vertex at the end of the contour.
bool RemoveVertexAt(VertexSizeType index)
Remove the vertex at a given index.
void SetVertexAt(VertexSizeType pointId, const mitk::Point3D &point)
Set the coordinates of an existing vertex at the given index.
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.
VertexSizeType GetIndex(const VertexType *vertex) const
Return the index of a given vertex within the contour.
bool IsClosed() const
Check whether the contour is closed.
bool RemoveVertexAt(const mitk::Point3D &point, double eps)
Remove the nearest vertex to a given 3D position within a search radius.
VertexIterator IteratorBegin()
Return a mutable iterator to the first vertex.
void Close()
Close the contour by logically connecting the last vertex to the first.
void SetVertexAt(VertexSizeType pointId, const VertexType *vertex)
Set the vertex data at a given index by copying from the provided vertex.
mitkClassMacroItkParent(ContourElement, itk::LightObject)
void Open()
Open the contour by removing the logical connection between last and first vertex.
VertexType * GetNextControlVertexAt(const mitk::Point3D &point, float eps)
Return the next control vertex after the nearest vertex to a given 3D position.
VertexType * GetVertexAt(const mitk::Point3D &point, float eps)
Find the nearest vertex to a given 3D position within a search radius.
void RedistributeControlVertices(const VertexType *vertex, int period)
Uniformly redistribute control point markers among the vertices.
void Clear()
Remove all vertices from the contour and free their memory.
VertexListType::size_type VertexSizeType
Size type for indexing into the vertex list.
bool RemoveVertexByIterator(VertexListType::iterator &iter)
bool RemoveVertex(const VertexType *vertex)
Remove a specific vertex from the contour by pointer identity.
VertexIterator IteratorEnd()
Return a mutable iterator past the last vertex.
ContourElement(const mitk::ContourElement &other)
void SetClosed(bool isClosed)
Set the closed state of the contour.
VertexType * GetVertexAt(VertexSizeType index)
Return the vertex at the given index.
VertexType * GetPreviousControlVertexAt(const mitk::Point3D &point, float eps)
Return the previous control vertex before the nearest vertex to a given 3D position.
const VertexListType * GetVertexList() const
Return a pointer to the internal vertex container.
void AddVertexAtFront(const mitk::Point3D &point, bool isControlPoint)
Add a vertex at the front of the contour.
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).
VertexListType GetControlVertices() const
Return a list of all vertices that are marked as control points.
void InsertVertexAtIndex(const mitk::Point3D &point, bool isControlPoint, VertexSizeType index)
Insert a vertex at the given index in the contour.
VertexIterator begin()
Return a mutable iterator to the first vertex (STL-compatible).
VertexSizeType GetSize() const
Return the number of vertices in this contour element.
ConstVertexIterator end() const
Return a const iterator past the last vertex (STL-compatible).
ConstVertexIterator ConstIteratorEnd() const
Return a const iterator past the last vertex.
Convenience header that includes all MITK numeric types.
Find image slices visible on a given plane.
MITKCORE_EXPORT const ScalarType eps
Epsilon value for floating point comparison (vnl_math::eps * 100).
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
Represents a single vertex of a contour.
ContourModelVertex(const mitk::Point3D &point, bool active=false)
Construct a vertex at the given position.
ContourModelVertex(const ContourModelVertex &other)
Copy constructor.
bool IsControlPoint
Flag indicating whether this vertex is a control point.
mitk::Point3D Coordinates
The 3D world coordinates of this vertex.