18#ifndef __vtkMRMLMarkupsNode_h
19#define __vtkMRMLMarkupsNode_h
23#include "vtkCurveGenerator.h"
28#include "vtkMRMLExport.h"
31#include <vtkParallelTransportFrame.h>
32#include <vtkPointLocator.h>
33#include <vtkSmartPointer.h>
66class vtkAlgorithmOutput;
69class vtkGeneralTransform;
74class vtkTransformPolyDataFilter;
139 virtual const char*
GetIcon() {
return ":/Icons/MarkupsGeneric.png";}
140 virtual const char*
GetAddIcon() {
return ":/Icons/MarkupsGenericMouseModePlace.png";}
141 virtual const char*
GetPlaceAddIcon() {
return ":/Icons/MarkupsGenericMouseModePlaceAdd.png";}
169 void WriteCLI(std::vector<std::string>& commandLine,
171 int multipleFlag = 1)
override;
185 int EndModify(
int previousDisableModifiedEventState)
override;
223 std::string printFormat =
"",
const std::string description =
"",
418 const double pos[3],
const double orientationMatrix[9],
const char* associatedNodeID,
int positionStatus =
PositionDefined);
603 virtual void ApplyTransform(vtkAbstractTransform* transform,
bool applyToLockedControlPoints);
745 vtkWarningMacro(
"vtkMRMLMarkupsNode::RemoveAllMarkups method is deprecated, please use RemoveAllControlPoints instead");
752 vtkWarningMacro(
"vtkMRMLMarkupsNode::MarkupExists method is deprecated, please use ControlPointExists instead");
759 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetNumberOfMarkups method is deprecated, please use GetNumberOfControlPoints instead");
765 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetNumberOfPointsInNthMarkup method is deprecated, please use GetNumberOfControlPoints instead");
772 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetMarkupPointVector method is deprecated, please use GetNthControlPointPositionVector instead");
782 vtkWarningMacro(
"vtkMRMLMarkupsNode::RemoveMarkup method is deprecated, please use RemoveNthControlPoint instead");
795 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetNthControlPointPositionFromArray method is deprecated, please use SetNthControlPointPosition instead");
809 const double positionWorld[3],
const double orientationMatrix_World[9],
812 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetNthControlPointPositionOrientationWorldFromArray method is deprecated,"
813 <<
" please use SetNthControlPointPositionOrientationWorld instead");
815 pointIndex, positionWorld, orientationMatrix_World, associatedNodeID, positionStatus);
830 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetCenterOfRotationVector method is deprecated, please use GetCenterOfRotation instead");
843 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetCenterOfRotationFromArray method is deprecated, please use SetCenterOfRotation instead");
854 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetNthControlPointOrientationFromArray method is deprecated, please use SetNthControlPointOrientation instead");
862 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetNthMarkupAssociatedNodeID method is deprecated, please use GetNthControlPointAssociatedNodeID instead");
868 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetNthMarkupAssociatedNodeID method is deprecated, please use SetNthControlPointAssociatedNodeID instead");
875 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetNthMarkupID method is deprecated, please use GetNthControlPointID instead");
882 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetNthMarkupLocked method is deprecated, please use GetNthControlPointLocked instead");
888 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetNthMarkupLocked method is deprecated, please use SetNthControlPointLocked instead");
895 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetNthMarkupLabel method is deprecated, please use GetNthControlPointLabel instead");
901 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetNthMarkupLabel method is deprecated, please use SetNthControlPointLabel instead");
907 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetMarkupLabelFormat method is deprecated, please use GetControlPointLabelFormat instead");
920 vtkWarningMacro(
"vtkMRMLMarkupsNode::ReplaceListNameInMarkupLabelFormat method is deprecated, please use ReplaceListNameInControlPointLabelFormat instead");
973 const double position_Node[3],
const double orientationMatrix_Node[9],
double orientationMatrix_World[9]);
977 const double position_World[3],
const double orientationMatrix_World[9],
double orientationMatrix_Node[9]);
Simple class for storing standard coded entries (coding scheme, value, meaning triplets)
friend class vtkMRMLMarkupsFiducialStorageNode
vtkParallelTransportFrame * GetCurveCoordinateSystemGeneratorWorld()
void SetNthControlPointOrientationFromArray(int n, const double orientationWXYZ[4])
void GetNthControlPointNormalWorld(int n, double normalWorld[3])
void GetControlPointPositionsWorld(vtkPoints *points)
Get a copy of all control point positions in world coordinate system.
void ClearValueForAllMeasurements()
void SetCenterOfRotationWorld(const double x, const double y, const double z)
int GetNthControlPointPositionWorld(int pointIndex, double worldxyz[3])
bool GetNthControlPointSelected(int n=0)
friend class qSlicerMarkupsModuleWidget
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
Alternative method to propagate events generated in Display nodes.
virtual bool GetControlPointPlacementComplete()
Returns true if no additional control points can be added to this node.
vtkMRMLUnitNode * GetUnitNode(const char *quantity)
Utility function to get unit node from scene.
vtkMRMLMarkupsNode(const vtkMRMLMarkupsNode &)
vtkMRMLStorageNode * CreateDefaultStorageNode() override
Create default storage node or nullptr if does not have one.
void ApplyTransform(vtkAbstractTransform *transform) override
bool GetNthMarkupLocked(int n=0)
int AddControlPointWorld(double point[3], std::string label=std::string())
void SetNthControlPointOrientationMatrix(int n, double orientationMatrix[9])
bool GetNthControlPointAutoCreated(int n)
void GetNthControlPointOrientationMatrixWorld(int n, vtkMatrix3x3 *matrix)
virtual const char * GetTypeDisplayName() override
std::vector< ControlPoint * > ControlPointsListType
void GetNthControlPointOrientationMatrix(int n, vtkMatrix3x3 *matrix)
int GetNthControlPointIndexByPositionStatus(int pointIndex, int positionStatus)
vtkSmartPointer< vtkParallelTransportFrame > CurveCoordinateSystemGeneratorWorld
vtkMRMLMeasurement * GetMeasurement(const char *name)
std::string GetNthMarkupLabel(int n=0)
void UpdateAllMeasurements()
int AddNControlPoints(int n, std::string label=std::string(), vtkVector3d *point=nullptr)
void GetControlPointLabels(vtkStringArray *labels)
Get all control point labels at once.
int GetControlPointIndexByID(const char *id)
void SetNthControlPointPositionOrientationWorldFromArray(const int pointIndex, const double positionWorld[3], const double orientationMatrix_World[9], const char *associatedNodeID, int positionStatus=PositionDefined)
virtual vtkPolyData * GetCurveWorld()
virtual vtkPoints * GetCurvePoints()
bool InsertControlPointWorld(int n, double pointWorld[3], std::string label=std::string())
bool InsertControlPoint(int n, vtkVector3d point, std::string label=std::string())
void SetNthControlPointOrientation(int n, double w, double x, double y, double z)
vtkVector3d CenterOfRotation
friend class vtkMRMLMarkupsJsonStorageNode
ControlPoint * GetNthControlPointCustomLog(int n, const char *failedMethodName)
int ControlPointPlacementStartIndex
Index of the control point index that placement is started from (if no other point is requested speci...
std::string GetControlPointLabelFormat()
std::string DefaultNodeNamePrefix
Store markup short name. Translated to the application language.
virtual void TransformOrientationMatrixFromWorldToNode(const double position_World[3], const double orientationMatrix_World[9], double orientationMatrix_Node[9])
Transform the orientation matrix from world to node coordinates.
virtual const char * GetPlaceAddIcon()
void SetFixedNumberOfControlPoints(bool fixed)
int Locked
Locks all the points and GUI.
void UnsetNthControlPointPosition(int pointIndex)
Set control point status to undefined.
void SetControlPointPlacementStartIndex(int)
void SetNthControlPointPositionMissing(int pointIndex)
Set control point status to ignored.
void SetNthControlPointID(int n, std::string id)
bool ResetNthControlPointID(int n)
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
int GetNthControlPointPositionStatus(int pointIndex)
Get control point position status (PositionUndefined, PositionPreview, PositionDefined)
virtual void UpdateCurvePolyFromControlPoints()
void AddMeasurement(vtkMRMLMeasurement *measurement)
vtkSmartPointer< vtkTransformPolyDataFilter > CurvePolyToWorldTransformer
int AddControlPoint(ControlPoint *controlPoint, bool autoLabel=true)
void SetNthControlPointAssociatedNodeID(int n, std::string id)
void SetNthControlPointVisibility(int n, bool flag)
int MaximumNumberOfControlPoints
int GetNumberOfMovableControlPoints()
Return the number of unlocked control points with defined position in this node.
virtual void UpdateAssignedAttribute()
virtual vtkPoints * GetCurvePointsWorld()
double * GetNthControlPointPosition(int pointIndex) VTK_SIZEHINT(3)
bool GetNthControlPointLocked(int n=0)
static int GetPositionStatusFromString(const char *name)
void SetNthControlPointPosition(const int pointIndex, const double x, const double y, const double z, int positionStatus=PositionDefined)
Set of the Nth control point position from coordinates.
void GetNthControlPointOrientationMatrixWorld(int n, double orientationMatrix[9])
void SetNthControlPointOrientationFromPointer(int n, const double *orientationWXYZ)
void GetNthControlPointPosition(int pointIndex, double point[3])
void SetNthMarkupLabel(int n, std::string label)
static void ConvertOrientationWXYZToMatrix(const double orientationWXYZ[4], double orientationMatrix[9])
bool IsUpdatingPoints
Flag set from SetControlPointPositionsWorld that pauses update of measurements until the update is co...
virtual void TransformOrientationMatrixFromNodeToWorld(const double position_Node[3], const double orientationMatrix_Node[9], double orientationMatrix_World[9])
Transform the orientation matrix from node to world coordinates.
vtkSmartPointer< vtkPolyData > CurveInputPoly
bool SetControlPointLabelsWorld(vtkStringArray *labels, vtkPoints *points, std::string separator="")
vtkMRMLCopyContentMacro(vtkMRMLMarkupsNode)
int GetNthControlPointIndexByID(const char *controlPointID)
vtkVector3d GetCenterOfRotationVector()
std::string GetMarkupLabelFormat()
double * GetNthControlPointOrientationMatrix(int n) VTK_SIZEHINT(9)
int GetNumberOfUndefinedControlPoints(bool includePreview=false)
Return the number of control points that have not been placed (not being previewed or skipped).
~vtkMRMLMarkupsNode() override
void SetNthMarkupAssociatedNodeID(int n, std::string id)
vtkSmartPointer< vtkMatrix4x4 > InteractionHandleToWorldMatrix
Transform that moves the xyz unit vectors and origin of the interaction handles to local coordinates.
int GetClosestControlPointIndexToPositionWorld(double pos[3], bool visibleOnly=false)
bool InsertControlPoint(ControlPoint *controlPoint, int targetIndex)
void SetControlPointLabelFormat(std::string format)
void SetNthControlPointPositionFromPointer(const int pointIndex, const double *pos)
virtual void UpdateMeasurementsInternal()
bool GetModifiedSinceRead() override
void CreateDefaultDisplayNodes() override
Create and observe default display node(s)
void SetNthControlPointPositionOrientationWorld(const int pointIndex, const double pos[3], const double orientationMatrix[9], const char *associatedNodeID, int positionStatus=PositionDefined)
std::string GenerateControlPointLabel(int controlPointIndex)
@ PointRemovedEvent
Control point(s) deleted. Modified event is NOT invoked.
@ PointPositionNonMissingEvent
Point missing before and now it is not missing.
@ LockModifiedEvent
Markups node lock status is changed. Modified event is invoked, too.
@ PointAboutToBeRemovedEvent
Point is about to be deleted. Thus it is alive when event is called.
@ CenterOfRotationModifiedEvent
When position of the center of rotation is changed (used for example for rotating closed curves).
@ PointModifiedEvent
Existing control point(s) modified, added, or removed. Modified event is NOT invoked.
@ FixedNumberOfControlPointsModifiedEvent
When fixed number of points set/unset.
@ PointAddedEvent
New control point(s) added. Modified event is NOT invoked.
@ PointPositionUndefinedEvent
Point position was defined and now it is not defined anymore (point deleted or position is not define...
@ LabelFormatModifiedEvent
Markups node label format changed. Modified event is invoked, too.
@ PointEndInteractionEvent
When an interaction with a control point process finishes.
@ PointPositionMissingEvent
Point was not not missing before and now it is missing.
@ PointStartInteractionEvent
When starting interacting with a control point.
@ PointPositionDefinedEvent
static const char * GetPositionStatusAsString(int id)
vtkVector4d GetNthControlPointOrientationVector(int pointIndex)
std::string ReplaceListNameInControlPointLabelFormat()
bool InsertControlPoint(int n, double point[3], std::string label=std::string())
void ResetNthControlPointPosition(int n)
Set control point status to preview.
void SetNthControlPointPositionFromArray(const int pointIndex, const double pos[3], int positionStatus=PositionDefined)
int AddNControlPoints(int n, std::string label, double point[3])
vtkVector< double, 9 > GetNthControlPointOrientationMatrixWorld(int n)
@ PositionStatus_Last
PositionStatus_Last: indicates the end of the enum (int first = 0, int last = PositionStatus_Last)
@ PositionMissing
PositionMissing: point is undefined and placement should not be attempted.
@ PositionUndefined
PositionUndefined: position is undefined (coordinate values must not be used).
@ PositionPreview
PositionPreview: new point is being placed, position is tentative.
@ PositionDefined
PositionDefined: position is specified.
int GetControlPointIndexByDescription(const char *description)
vtkVector3d GetNthControlPointNormal(int n)
bool CanApplyNonLinearTransforms() const override
bool InsertControlPointWorld(int n, vtkVector3d pointWorld, std::string label=std::string())
std::string GetNthControlPointID(int n)
Get the id for the Nth control point.
vtkVector3d GetMarkupPointVector(int markupIndex, int)
vtkCurveGenerator * GetCurveGenerator()
vtkMRMLMarkupsDisplayNode * GetMarkupsDisplayNode()
Return a cast display node, returns null if none.
std::string TypeDisplayName
Store markup type GUI display name. Translated to the application language.
void GetMarkupPoint(int markupIndex, int pointIndex, double point[3])
void SetNthMarkupLocked(int n, bool flag)
vtkSmartPointer< vtkCurveGenerator > CurveGenerator
Converts curve control points to curve points.
void SetCenterOfRotation(const double position[3])
int GetNumberOfPointsInNthMarkup(int)
vtkVector3d GetNthControlPointNormalWorld(int n)
bool GetNthControlPointVisibility(int n=0)
void OnTransformNodeReferenceChanged(vtkMRMLTransformNode *transformNode) override
Called when transform node reference added/modified/removed.
int GetControlPointPlacementStartIndex()
void SetNthControlPointOrientationMatrixWorld(int n, const double orientationMatrix[9])
int GetControlPointIndexByLabel(const char *label)
void SetCenterOfRotationFromArray(const double pos[3])
virtual vtkPolyData * GetCurve()
void PrintSelf(ostream &os, vtkIndent indent) override
bool GetFixedNumberOfControlPoints()
virtual const char * GetMarkupType()
std::string GetNthControlPointLabel(int n=0)
int AddControlPoint(double point[3], std::string label=std::string())
int RequiredNumberOfControlPoints
virtual const char * GetAddIcon()
void SetNthMeasurement(int id, vtkMRMLMeasurement *measurement)
virtual const char * GetDefaultNodeNamePrefix()
void SetNthControlPointSelected(int n, bool flag)
vtkSmartPointer< vtkStringArray > TextList
virtual std::string GetPropertiesLabelText()
int LastUsedControlPointNumber
void SetControlPointPositionsWorld(vtkPoints *points, bool setUndefinedPoints=true)
void SwapControlPoints(int m1, int m2)
Swap two control points (position data and all other properties).
void GetBounds(double bounds[6]) override
void SetNthControlPointDescription(int n, std::string description)
vtkSmartPointer< vtkPointLocator > TransformedCurvePolyLocator
int GetNumberOfDefinedControlPoints(bool includePreview=false)
Return the number of control points that are already placed (not being previewed or undefined).
std::string ControlPointLabelFormat
vtkSmartPointer< vtkGeneralTransform > CurvePolyToWorldTransform
vtkVector3d GetNthControlPointPositionVector(int pointIndex)
std::string GetNthControlPointAssociatedNodeID(int n=0)
void SetCenterOfRotationWorld(const double positionWorld[3])
void SetNthControlPointOrientation(int n, const double wxyz[4])
void SetNthControlPointPositionWorld(const int pointIndex, const double x, const double y, const double z, int positionStatus=PositionDefined)
std::string ReplaceListNameInMarkupLabelFormat()
void SetNthControlPointLabel(int n, std::string label)
void RemoveMarkup(int pointIndex)
void SetCenterOfRotationFromPointer(const double *pos)
std::string PropertiesLabelText
void GetNthControlPointNormal(int n, double normal[3])
void SetMarkupLabelFormat(std::string format)
std::string GetNthMarkupAssociatedNodeID(int n=0)
virtual void ApplyTransform(vtkAbstractTransform *transform, bool applyToLockedControlPoints)
std::vector< ControlPoint * > * GetControlPoints()
Return a pointer to the std::vector of control points stored in this node.
void SetNthControlPointOrientationMatrixWorld(int n, vtkMatrix3x3 *matrix)
bool ControlPointExists(int n)
Return true if n is a valid control point, false otherwise.
void SetNthControlPointPositionWorld(const int pointIndex, const double position[3], int positionStatus=PositionDefined)
vtkMRMLMeasurement * GetNthMeasurement(int id)
bool GetCenterOfRotationWorld(double worldxyz[3])
void SetNthControlPointPosition(const int pointIndex, const double position[3], int positionStatus=PositionDefined)
int AddControlPointWorld(double x, double y, double z, std::string label=std::string())
bool GetCenterOfRotation(double point[3])
bool FixedNumberOfControlPoints
friend class vtkMRMLMarkupsStorageNode
Make the storage node a friend so that ReadDataInternal can set the ControlPoint ids.
virtual vtkAlgorithmOutput * GetCurveWorldConnection()
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file.
int GetNumberOfControlPoints()
Return the number of control points that are stored in this node.
std::string GenerateUniqueControlPointID()
virtual void RemoveAllControlPoints()
Clear out the node of all control points.
ControlPoint * GetNthControlPointByID(const char *controlPointID)
Get the Nth control point based on it's ID.
std::string GetNthControlPointDescription(int n=0)
void SetLocked(int locked)
int AddControlPointWorld(vtkVector3d point, std::string label=std::string())
virtual vtkMatrix4x4 * GetInteractionHandleToWorldMatrix()
4x4 matrix detailing the orientation and position in world coordinates of the interaction handles.
virtual void UpdateInteractionHandleToWorldMatrix()
Calculates the handle to world matrix based on the current control points.
int GetControlPointIndexFromInterpolatedPointIndex(vtkIdType interpolatedPointIndex)
Converts curve point index to control point index.
virtual const char * GetIcon()
ControlPointsListType ControlPoints
Vector of control points.
void SetCenterOfRotation(const double x, const double y, const double z)
void RemoveNthMeasurement(int id)
void operator=(const vtkMRMLMarkupsNode &)
void WriteCLI(std::vector< std::string > &commandLine, std::string prefix, int coordinateSystem=vtkMRMLStorageNode::CoordinateSystemRAS, int multipleFlag=1) override
virtual void UnsetAllControlPoints()
int GetNumberOfEnabledMeasurements()
static void ConvertOrientationMatrixToWXYZ(const double orientationMatrix[9], double orientationWXYZ[4])
int AddControlPoint(vtkVector3d point, std::string label=std::string())
void GetRASBounds(double bounds[6]) override
vtkVector3d GetCenterOfRotation()
int GetNumberOfMeasurements()
void RemoveAllMeasurements()
std::string GetNthMarkupID(int n=0)
virtual void WriteMeasurementsToDescription()
void RestoreNthControlPointPosition(int n)
Set control point status to defined and return to the previous position.
bool GetNthControlPointPositionVisibility(int n=0)
vtkCollection * Measurements
List of measurements stored for the markup.
void SetNthControlPointLocked(int n, bool flag)
void GetNthControlPointOrientation(int n, double orientationWXYZ[4])
void SetNthControlPointPositionWorldFromArray(const int pointIndex, const double pos[3], int positionStatus=PositionDefined)
void RemoveNthControlPoint(int pointIndex)
Remove Nth Control Point.
int AddControlPoint(double x, double y, double z, std::string label=std::string())
vtkVector3d GetNthControlPointPositionWorld(int pointIndex)
void SetNthMeasurement(int id, const std::string &name, double value, const std::string &units, std::string printFormat="", const std::string description="", vtkCodedEntry *quantityCode=nullptr, vtkCodedEntry *derivationCode=nullptr, vtkCodedEntry *unitsCode=nullptr, vtkCodedEntry *methodCode=nullptr)
void SetNthControlPointAutoCreated(int n, bool flag)
ControlPoint * GetNthControlPoint(int n)
Return a pointer to the Nth control point stored in this node, null if n is out of bounds.
void SetNthControlPointOrientationMatrix(int n, vtkMatrix3x3 *matrix)
int EndModify(int previousDisableModifiedEventState) override
End modifying the node. Updates pending measurements and other updates.
Class for storing well-defined measurement results, using coded entries.
A superclass for other storage nodes.
Node that holds the information about a unit.
std::string AssociatedNodeID
double OrientationMatrix[9]