12 #ifndef mitkContourModel_h
13 #define mitkContourModel_h
51 itkFactorylessNewMacro(Self);
83 void Deselect() { this->m_SelectedVertex =
nullptr; }
92 if (this->m_SelectedVertex)
94 m_SelectedVertex->IsControlPoint = isControlPoint;
105 this->m_lineInterpolation = interpolation;
334 bool findClosest =
true)
const;
456 void Expand(
unsigned int timeSteps)
override;
#define MITKCONTOURMODEL_EXPORT
Base class of all data objects.
VertexListType::const_iterator ConstVertexIterator
Const iterator for traversing vertices.
VertexListType::iterator VertexIterator
Mutable iterator for traversing vertices.
std::deque< VertexType * > VertexListType
Alias for the container type storing vertex pointers.
VertexListType::size_type VertexSizeType
Size type for indexing into the vertex list.
A time-resolved contour representation consisting of linked vertices in 3D space.
void InsertVertexAtIndex(const Point3D &vertex, int index, bool isControlPoint=false, TimeStepType timestep=0)
Insert a vertex at given index.
void Concatenate(ContourModel *other, TimeStepType timestep=0, bool check=false)
Concatenate two contours. The starting control point of the other will be added at the end of the con...
void UpdateContour(const ContourModel *sourceModel, TimeStepType destinationTimeStep, TimeStepType sourceTimeStep)
VertexIterator Begin(TimeStepType timestep=0) const
Returns a const VertexIterator at the start element of the contour.
bool GetLineSegmentForPoint(Point3D &point, float eps, TimeStepType timestep, mitk::ContourElement::VertexType *previousVertex=nullptr, mitk::ContourElement::VertexType *nextVertex=nullptr)
LineSegmentInterpolation GetLineSegmentInterpolation()
Get the current interpolation mode for line segments between control points.
void AddVertex(const Point3D &vertex, TimeStepType timestep=0)
Add a vertex to the contour at given timestep. The vertex is added at the end of contour.
int GetIndex(const VertexType *vertex, TimeStepType timestep=0)
Return the index of a given vertex within the contour at the specified time step.
ContourElement::VertexType VertexType
const VertexType * GetVertexAt(mitk::Point3D &point, float eps, TimeStepType timestep) const
Find the nearest vertex to a given 3D position at a specific time step.
void AddVertexAtFront(const Point3D &vertex, TimeStepType timestep=0)
Add a vertex to the contour at given timestep AT THE FRONT of the contour. The vertex is added at the...
static void ShiftVertex(VertexType *vertex, Vector3D &vector)
void AddVertexAtFront(const Point3D &vertex, bool isControlPoint, TimeStepType timestep=0)
Add a vertex to the contour at given timestep AT THE FRONT of the contour.
virtual bool IsEmpty(TimeStepType timestep) const
Returns whether the contour model is empty at a given timestep.
LineSegmentInterpolation m_lineInterpolation
mitkClassMacro(ContourModel, BaseData)
virtual void SetClosed(bool isClosed, TimeStepType timestep=0)
Set closed property to given boolean.
VertexType * GetSelectedVertex()
Get the currently selected vertex.
ContourElement::VertexIterator VertexIterator
virtual const VertexType * GetVertexAt(int index, TimeStepType timestep=0) const
Returns the vertex at the index position within the container. If the index or timestep is invalid a ...
void SetRequestedRegionToLargestPossibleRegion() override
Inherit from base data - no region support available for contourModel objects.
std::vector< ContourElement::Pointer > ContourModelSeries
ContourModelSeries m_ContourSeries
virtual void Clear(TimeStepType timestep)
Clear the storage container at given timestep.
bool IsEmpty() const override
Returns whether the contour model is empty.
virtual void Open(TimeStepType timestep=0)
Set isClosed to false contour. The link between the last control point the first point will be remove...
virtual void RedistributeControlVertices(int period, TimeStepType timestep)
Redistributes control vertices with a given period (as number of vertices)
ContourElement::VertexListType VertexListType
virtual const VertexType * GetPreviousControlVertexAt(mitk::Point3D &point, float eps, TimeStepType timestep) const
Return the previous control vertex before the nearest vertex to a given 3D position.
void ShiftContour(Vector3D &translate, TimeStepType timestep=0)
Shift the whole contour by a translation vector at given timestep.
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Inherit from base data - no region support available for contourModel objects.
VertexListType GetControlVertices(TimeStepType timestep)
Returns a list pointing to all vertices that are indicated to be control points.
void ShiftSelectedVertex(Vector3D &translate)
Shift the currently selected vertex by a translation vector.
void Initialize() override
Initialize all data objects.
void AddVertexAtFront(const VertexType &vertex, TimeStepType timestep=0)
Add a vertex to the contour at given timestep AT THE FRONT of the contour. The vertex is added at the...
bool SetControlVertexAt(Point3D &point, float eps, TimeStepType timestep=0)
void Deselect()
Clear the current vertex selection.
bool RemoveVertexAt(Point3D &point, float eps, TimeStepType timestep=0)
Remove a vertex at a query position in 3D space.
void SetLineSegmentInterpolation(LineSegmentInterpolation interpolation)
Set the interpolation mode for line segments between control points.
void ExecuteOperation(Operation *operation) override
overwrite if the Data can be called by an Interactor (StateMachine).
VertexIterator IteratorBegin(TimeStepType timestep=0) const
Returns a const VertexIterator at the start element of the contour.
bool IsNearContour(Point3D &point, float eps, TimeStepType timestep) const
Check whether a given point lies near the contour at the specified time step.
int GetNumberOfVertices(TimeStepType timestep=0) const
Returns the number of vertices at a given timestep.
void Clear() override
Clear the storage container.
void ClearData() override
reset to non-initialized state, release memory
bool SelectControlVertexAt(const Point3D &point, float eps, TimeStepType timestep=0)
Mark a control vertex at a given position in 3D space.
void SetRequestedRegion(const itk::DataObject *data) override
Inherit from base data - no region support available for contourModel objects.
void Initialize(const ContourModel &other)
Initialize object with specs of other contour. Note: No data will be copied.
virtual const VertexType * GetNextControlVertexAt(mitk::Point3D &point, float eps, TimeStepType timestep) const
Return the next control vertex after the nearest vertex to a given 3D position.
void AddVertex(const VertexType &vertex, TimeStepType timestep=0)
Add a vertex to the contour at given timestep. A copy of the passed vertex is added at the end of con...
bool IsEmptyTimeStep(unsigned int t) const override
Check whether the given time step has no associated contour data.
bool IsClosed(int timestep=0) const
Return if the contour is closed or not.
void AddVertex(const Point3D &vertex, bool isControlPoint, TimeStepType timestep=0)
Add a vertex to the contour.
ContourModel(const ContourModel &other)
void SetSelectedVertexAsControlPoint(bool isControlPoint=true)
Set or clear the control point flag on the currently selected vertex.
VertexType * m_SelectedVertex
void UpdateOutputInformation() override
Update the OutputInformation of a ContourModel object.
bool GetLineSegmentForPoint(const mitk::Point3D &point, float eps, TimeStepType timestep, ContourElement::VertexSizeType &segmentStartIndex, ContourElement::VertexSizeType &segmentEndIndex, mitk::Point3D &closestContourPoint, bool findClosest=true) const
bool RemoveVertexAt(int index, TimeStepType timestep=0)
Remove a vertex at given index within the container.
void Expand(unsigned int timeSteps) override
Expand the contour model and its TimeGeometry to given number of timesteps.
bool SetVertexAt(int pointId, const VertexType *vertex, TimeStepType timestep=0)
Set a coordinates and control state for point at given index.
bool RemoveVertex(const VertexType *vertex, TimeStepType timestep=0)
Remove a vertex at given timestep within the container.
bool SetVertexAt(int pointId, const Point3D &point, TimeStepType timestep=0)
Set a coordinates for point at given index.
bool SelectVertexAt(const Point3D &point, float eps, TimeStepType timestep=0)
Mark a vertex at a given position in 3D space.
LineSegmentInterpolation
Interpolation mode for line segments between control points.
@ LINEAR
Straight line segments between control points.
VertexIterator End(TimeStepType timestep=0) const
Returns a const VertexIterator at the end element of the contour.
void InitializeEmpty() override
Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least creat...
virtual void Close(TimeStepType timestep=0)
Close the contour. The last control point will be linked with the first point.
VertexIterator IteratorEnd(TimeStepType timestep=0) const
Returns a const VertexIterator at the end element of the contour.
VertexListType GetVertexList(TimeStepType timestep)
Returns the container of the vertices.
bool VerifyRequestedRegion() override
Inherit from base data - no region support available for contourModel objects.
bool SelectVertexAt(int index, TimeStepType timestep=0)
Mark a vertex at an index in the container as selected.
ContourElement::ConstVertexIterator ConstVertexIterator
bool SetControlVertexAt(int index, TimeStepType timestep=0)
Mark a vertex at an index in the container as control point.
Base class for all operations in the undo/redo framework.
Find image slices visible on a given plane.
MITKCORE_EXPORT const ScalarType eps
Epsilon value for floating point comparison (vnl_math::eps * 100).
std::size_t TimeStepType
Type for time step indices (non-negative integers starting from 0).
itkEventMacroDeclaration(BoundingShapeInteractionEvent, itk::AnyEvent)
Represents a single vertex of a contour.