18 #ifndef __vtkMRMLMarkupsNode_h 19 #define __vtkMRMLMarkupsNode_h 28 #include "vtkSlicerMarkupsModuleMRMLExport.h" 31 #include <vtkPointLocator.h> 32 #include <vtkSmartPointer.h> 33 #include <vtkVector.h> 37 class vtkParallelTransportFrame;
67 class vtkAlgorithmOutput;
70 class vtkGeneralTransform;
75 class vtkTransformPolyDataFilter;
91 this->Position[0] = 0.0;
92 this->Position[1] = 0.0;
93 this->Position[2] = 0.0;
95 this->OrientationMatrix[0] = 1.0;
96 this->OrientationMatrix[1] = 0.0;
97 this->OrientationMatrix[2] = 0.0;
99 this->OrientationMatrix[3] = 0.0;
100 this->OrientationMatrix[4] = 1.0;
101 this->OrientationMatrix[5] = 0.0;
103 this->OrientationMatrix[6] = 0.0;
104 this->OrientationMatrix[7] = 0.0;
105 this->OrientationMatrix[8] = 1.0;
110 PositionStatus = PositionUndefined;
120 double OrientationMatrix[9];
138 void PrintSelf(ostream& os, vtkIndent indent)
override;
140 virtual const char*
GetIcon() {
return ":/Icons/MarkupsGeneric.png";}
141 virtual const char*
GetAddIcon() {
return ":/Icons/MarkupsGenericMouseModePlace.png";}
142 virtual const char*
GetPlaceAddIcon() {
return ":/Icons/MarkupsGenericMouseModePlaceAdd.png";}
159 void WriteXML(ostream& of,
int indent)
override;
165 void WriteCLI(std::vector<std::string>& commandLine,
167 int multipleFlag = 1)
override;
181 int EndModify(
int previousDisableModifiedEventState)
override;
194 int GetNumberOfMeasurements();
195 int GetNumberOfEnabledMeasurements();
199 void RemoveNthMeasurement(
int id);
200 void ClearValueForAllMeasurements();
205 void UpdateAllMeasurements();
218 void SetNthMeasurement(
int id,
const std::string& name,
double value,
const std::string &units,
219 std::string printFormat =
"",
const std::string description =
"",
222 void RemoveAllMeasurements();
234 LockModifiedEvent = 19000,
238 PointPositionDefinedEvent,
239 PointPositionUndefinedEvent,
261 static const char* GetPositionStatusAsString(
int id);
262 static int GetPositionStatusFromString(
const char* name);
265 virtual void RemoveAllControlPoints();
266 virtual void UnsetAllControlPoints();
276 vtkGetMacro(Locked,
int);
277 void SetLocked(
int locked);
278 vtkBooleanMacro(Locked,
int);
285 bool ControlPointExists(
int n);
288 int GetNumberOfControlPoints();
290 int GetNumberOfDefinedControlPoints(
bool includePreview=
false);
292 int GetNumberOfUndefinedControlPoints(
bool includePreview =
false);
295 ControlPoint* GetNthControlPoint(
int n);
297 std::vector<ControlPoint*>* GetControlPoints();
306 int AddNControlPoints(
int n, std::string label = std::string(), vtkVector3d* point =
nullptr);
307 int AddNControlPoints(
int n, std::string label,
double point[3]);
315 void SetControlPointPositionsWorld(vtkPoints* points);
318 void GetControlPointPositionsWorld(vtkPoints* points);
322 int AddControlPoint(vtkVector3d point, std::string label = std::string());
323 int AddControlPoint(
double point[3], std::string label = std::string());
324 int AddControlPoint(
double x,
double y,
double z, std::string label = std::string());
332 int AddControlPoint(ControlPoint *controlPoint,
bool autoLabel=
true);
337 int AddControlPointWorld(vtkVector3d point, std::string label = std::string());
338 int AddControlPointWorld(
double point[3], std::string label = std::string());
339 int AddControlPointWorld(
double x,
double y,
double z, std::string label = std::string());
349 bool InsertControlPoint(ControlPoint* controlPoint,
int targetIndex);
350 bool InsertControlPoint(
int n, vtkVector3d point, std::string label = std::string());
351 bool InsertControlPoint(
int n,
double point[3], std::string label = std::string());
357 bool InsertControlPointWorld(
int n, vtkVector3d pointWorld, std::string label = std::string());
358 bool InsertControlPointWorld(
int n,
double pointWorld[3], std::string label = std::string());
362 void RemoveNthControlPoint(
int pointIndex);
365 void SwapControlPoints(
int m1,
int m2);
369 bool GetNthControlPointAutoCreated(
int n);
370 void SetNthControlPointAutoCreated(
int n,
bool flag);
376 void GetNthControlPointPosition(
int pointIndex,
double point[3]);
377 double* GetNthControlPointPosition(
int pointIndex) VTK_SIZEHINT(3);
384 vtkVector3d GetNthControlPointPositionVector(
int pointIndex);
389 int GetNthControlPointPositionWorld(
int pointIndex,
double worldxyz[3]);
390 vtkVector3d GetNthControlPointPositionWorld(
int pointIndex);
396 void SetNthControlPointPosition(
const int pointIndex,
const double x,
const double y,
const double z,
int positionStatus = PositionDefined);
397 void SetNthControlPointPosition(
const int pointIndex,
const double position[3],
int positionStatus = PositionDefined);
404 void SetNthControlPointPositionWorld(
const int pointIndex,
const double x,
const double y,
const double z,
int positionStatus = PositionDefined);
405 void SetNthControlPointPositionWorld(
const int pointIndex,
const double position[3],
int positionStatus = PositionDefined);
411 void SetNthControlPointPositionOrientationWorld(
const int pointIndex,
412 const double pos[3],
const double orientationMatrix[9],
const char* associatedNodeID,
int positionStatus = PositionDefined);
417 void SetNthControlPointOrientation(
int n,
double w,
double x,
double y,
double z);
418 void SetNthControlPointOrientation(
int n,
const double wxyz[4]);
423 void GetNthControlPointOrientation(
int n,
double orientationWXYZ[4]);
428 double* GetNthControlPointOrientationMatrix(
int n) VTK_SIZEHINT(9);
429 void SetNthControlPointOrientationMatrix(
int n,
double orientationMatrix[9]);
434 void GetNthControlPointOrientationMatrix(
int n, vtkMatrix3x3* matrix);
435 void SetNthControlPointOrientationMatrix(
int n, vtkMatrix3x3* matrix);
441 void GetNthControlPointOrientationMatrixWorld(
int n,
double orientationMatrix[9]);
442 vtkVector<double, 9> GetNthControlPointOrientationMatrixWorld(
int n);
443 void SetNthControlPointOrientationMatrixWorld(
int n,
const double orientationMatrix[9]);
448 void GetNthControlPointOrientationMatrixWorld(
int n, vtkMatrix3x3* matrix);
449 void SetNthControlPointOrientationMatrixWorld(
int n, vtkMatrix3x3* matrix);
453 int GetNthControlPointPositionStatus(
int pointIndex);
459 int GetNthControlPointIndexByPositionStatus(
int pointIndex,
int positionStatus);
462 void UnsetNthControlPointPosition(
int pointIndex);
465 void SetNthControlPointPositionMissing(
int pointIndex);
468 void ResetNthControlPointPosition(
int n);
471 void RestoreNthControlPointPosition(
int n);
476 vtkVector3d GetCenterOfRotation();
481 bool GetCenterOfRotation(
double point[3]);
487 bool GetCenterOfRotationWorld(
double worldxyz[3]);
492 void SetCenterOfRotation(
const double x,
const double y,
const double z);
493 void SetCenterOfRotation(
const double position[3]);
499 void SetCenterOfRotationWorld(
const double x,
const double y,
const double z);
500 void SetCenterOfRotationWorld(
const double positionWorld[3]);
505 void GetNthControlPointNormal(
int n,
double normal[3]);
506 vtkVector3d GetNthControlPointNormal(
int n);
511 void GetNthControlPointNormalWorld(
int n,
double normalWorld[3]);
512 vtkVector3d GetNthControlPointNormalWorld(
int n);
517 std::string GetNthControlPointAssociatedNodeID(
int n = 0);
518 void SetNthControlPointAssociatedNodeID(
int n, std::string
id);
522 std::string GetNthControlPointID(
int n);
525 int GetNthControlPointIndexByID(
const char* controlPointID);
527 ControlPoint* GetNthControlPointByID(
const char* controlPointID);
531 bool GetNthControlPointSelected(
int n = 0);
534 void SetNthControlPointSelected(
int n,
bool flag);
538 bool GetNthControlPointLocked(
int n = 0);
545 void SetNthControlPointLocked(
int n,
bool flag);
549 bool GetNthControlPointVisibility(
int n = 0);
554 bool GetNthControlPointPositionVisibility(
int n = 0);
563 void SetNthControlPointVisibility(
int n,
bool flag);
567 std::string GetNthControlPointLabel(
int n = 0);
568 void SetNthControlPointLabel(
int n, std::string label);
572 void GetControlPointLabels(vtkStringArray* labels);
577 std::string GetNthControlPointDescription(
int n = 0);
578 void SetNthControlPointDescription(
int n, std::string description);
597 std::string GetControlPointLabelFormat();
598 void SetControlPointLabelFormat(std::string format);
605 std::string ReplaceListNameInControlPointLabelFormat();
619 bool ResetNthControlPointID(
int n);
625 bool GetFixedNumberOfControlPoints();
626 void SetFixedNumberOfControlPoints(
bool fixed);
632 vtkGetMacro(RequiredNumberOfControlPoints,
int);
642 vtkGetMacro(MaximumNumberOfControlPoints,
int);
647 static void ConvertOrientationMatrixToWXYZ(
const double orientationMatrix[9],
double orientationWXYZ[4]);
648 static void ConvertOrientationWXYZToMatrix(
const double orientationWXYZ[4],
double orientationMatrix[9]);
653 virtual vtkPoints* GetCurvePoints();
654 virtual vtkPoints* GetCurvePointsWorld();
655 virtual vtkPolyData* GetCurve();
656 virtual vtkPolyData* GetCurveWorld();
657 virtual vtkAlgorithmOutput* GetCurveWorldConnection();
661 int GetControlPointIndexFromInterpolatedPointIndex(vtkIdType interpolatedPointIndex);
664 vtkGetMacro(CurveClosed,
bool);
672 void GetBounds(
double bounds[6])
override;
676 int GetClosestControlPointIndexToPositionWorld(
double pos[3],
bool visibleOnly=
false);
679 virtual vtkMatrix4x4* GetInteractionHandleToWorldMatrix();
683 virtual std::string GetPropertiesLabelText();
693 virtual bool GetControlPointPlacementComplete();
702 int GetControlPointPlacementStartIndex();
703 void SetControlPointPlacementStartIndex(
int);
710 vtkGetMacro(LastUsedControlPointNumber,
int);
711 vtkSetMacro(LastUsedControlPointNumber,
int);
725 vtkWarningMacro(
"vtkMRMLMarkupsNode::RemoveAllMarkups method is deprecated, please use RemoveAllControlPoints instead");
726 this->RemoveAllControlPoints();
732 vtkWarningMacro(
"vtkMRMLMarkupsNode::MarkupExists method is deprecated, please use ControlPointExists instead");
733 return this->ControlPointExists(
n);
739 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetNumberOfMarkups method is deprecated, please use GetNumberOfControlPoints instead");
740 return this->GetNumberOfControlPoints();
745 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetNumberOfPointsInNthMarkup method is deprecated, please use GetNumberOfControlPoints instead");
746 return this->GetNumberOfControlPoints();
752 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetMarkupPointVector method is deprecated, please use GetNthControlPointPositionVector instead");
753 return this->GetNthControlPointPositionVector(markupIndex);
757 void GetMarkupPoint(
int markupIndex,
int pointIndex,
double point[3]);
762 vtkWarningMacro(
"vtkMRMLMarkupsNode::RemoveMarkup method is deprecated, please use RemoveNthControlPoint instead");
763 this->RemoveNthControlPoint(pointIndex);
769 void SetNthControlPointPositionFromPointer(
const int pointIndex,
const double* pos);
775 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetNthControlPointPositionFromArray method is deprecated, please use SetNthControlPointPosition instead");
776 this->SetNthControlPointPosition(pointIndex, pos[0], pos[1], pos[2], positionStatus);
782 void SetNthControlPointPositionWorldFromArray(
const int pointIndex,
const double pos[3],
int positionStatus = PositionDefined);
789 const double positionWorld[3],
const double orientationMatrix_World[9],
790 const char* associatedNodeID,
int positionStatus = PositionDefined)
792 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetNthControlPointPositionOrientationWorldFromArray method is deprecated," 793 <<
" please use SetNthControlPointPositionOrientationWorld instead");
794 this->SetNthControlPointPositionOrientationWorld(
795 pointIndex, positionWorld, orientationMatrix_World, associatedNodeID, positionStatus);
803 vtkVector4d GetNthControlPointOrientationVector(
int pointIndex);
810 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetCenterOfRotationVector method is deprecated, please use GetCenterOfRotation instead");
811 return this->GetCenterOfRotation();
817 void SetCenterOfRotationFromPointer(
const double* pos);
823 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetCenterOfRotationFromArray method is deprecated, please use SetCenterOfRotation instead");
824 this->SetCenterOfRotation(pos[0], pos[1], pos[2]);
831 void SetNthControlPointOrientationFromPointer(
int n,
const double* orientationWXYZ);
834 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetNthControlPointOrientationFromArray method is deprecated, please use SetNthControlPointOrientation instead");
835 this->SetNthControlPointOrientation(
n, orientationWXYZ[0], orientationWXYZ[1], orientationWXYZ[2], orientationWXYZ[3]);
842 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetNthMarkupAssociatedNodeID method is deprecated, please use GetNthControlPointAssociatedNodeID instead");
843 return this->GetNthControlPointAssociatedNodeID(
n);
848 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetNthMarkupAssociatedNodeID method is deprecated, please use SetNthControlPointAssociatedNodeID instead");
849 this->SetNthControlPointAssociatedNodeID(
n,
id);
855 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetNthMarkupID method is deprecated, please use GetNthControlPointID instead");
856 return this->GetNthControlPointID(
n);
862 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetNthMarkupLocked method is deprecated, please use GetNthControlPointLocked instead");
863 return this->GetNthControlPointLocked(
n);
868 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetNthMarkupLocked method is deprecated, please use SetNthControlPointLocked instead");
869 this->SetNthControlPointLocked(
n, flag);
875 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetNthMarkupLabel method is deprecated, please use GetNthControlPointLabel instead");
876 return this->GetNthControlPointLabel(
n);
881 vtkWarningMacro(
"vtkMRMLMarkupsNode::SetNthMarkupLabel method is deprecated, please use SetNthControlPointLabel instead");
882 this->SetNthControlPointLabel(
n, label);
887 vtkWarningMacro(
"vtkMRMLMarkupsNode::GetMarkupLabelFormat method is deprecated, please use GetControlPointLabelFormat instead");
888 return this->GetControlPointLabelFormat();
895 return this->SetControlPointLabelFormat(format);
900 vtkWarningMacro(
"vtkMRMLMarkupsNode::ReplaceListNameInMarkupLabelFormat method is deprecated, please use ReplaceListNameInControlPointLabelFormat instead");
901 return this->ReplaceListNameInControlPointLabelFormat();
917 bool SetControlPointLabelsWorld(vtkStringArray* labels, vtkPoints* points, std::string separator =
"");
922 ControlPoint* GetNthControlPointCustomLog(
int n,
const char* failedMethodName);
927 void SetNthControlPointID(
int n, std::string
id);
932 std::string GenerateUniqueControlPointID();
934 std::string GenerateControlPointLabel(
int controlPointIndex);
936 virtual void UpdateCurvePolyFromControlPoints();
942 virtual void UpdateMeasurementsInternal();
946 virtual void WriteMeasurementsToDescription();
949 virtual void UpdateInteractionHandleToWorldMatrix();
952 virtual void TransformOrientationMatrixFromNodeToWorld(
953 const double position_Node[3],
const double orientationMatrix_Node[9],
double orientationMatrix_World[9]);
956 virtual void TransformOrientationMatrixFromWorldToNode(
957 const double position_World[3],
const double orientationMatrix_World[9],
double orientationMatrix_Node[9]);
961 int RequiredNumberOfControlPoints{0};
964 int MaximumNumberOfControlPoints{-1};
966 bool CurveClosed{
false};
996 bool FixedNumberOfControlPoints{
false};
998 std::string ControlPointLabelFormat{
"%N-%d"};
1003 int LastUsedControlPointNumber{0};
1006 int ControlPointPlacementStartIndex{ -1 };
1021 bool IsUpdatingPoints{
false};
void SetNthMarkupAssociatedNodeID(int n, std::string id)
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
alternative method to propagate events generated in Display nodes
ControlPointsListType ControlPoints
Vector of control points.
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file
virtual const char * GetDefaultNodeNamePrefix()
Get markup short name.
PositionMissing: point is undefined and placement should not be attempted.
Filter that generates curves between points of an input polydata.
void SetNthControlPointPositionFromArray(const int pointIndex, const double pos[3], int positionStatus=PositionDefined)
When fixed number of points set/unset.
virtual vtkMRMLStorageNode * CreateDefaultStorageNode()
virtual void GetBounds(double bounds[6])
int GetNumberOfPointsInNthMarkup(int)
std::vector< ControlPoint * > ControlPointsListType
bool GetNthMarkupLocked(int n=0)
vtkSmartPointer< vtkCurveGenerator > CurveGenerator
Converts curve control points to curve points.
virtual bool GetModifiedSinceRead()
Class for storing well-defined measurement results, using coded entries.
vtkSmartPointer< vtkStringArray > TextList
void SetNthControlPointOrientationFromArray(int n, const double orientationWXYZ[4])
void SetNthMarkupLocked(int n, bool flag)
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
virtual const char * GetAddIcon()
vtkSmartPointer< vtkPolyData > CurveInputPoly
vtkVector3d GetMarkupPointVector(int markupIndex, int)
std::string GetNthMarkupLabel(int n=0)
void SetMarkupLabelFormat(std::string format)
void operator=(const vtkMRMLDisplayableNode &)
std::string GetMarkupLabelFormat()
std::string GetNthMarkupAssociatedNodeID(int n=0)
PositionUndefined: position is undefined (coordinate values must not be used).
void SetNthMarkupLabel(int n, std::string label)
PositionDefined: position is specified.
vtkSmartPointer< vtkTransformPolyDataFilter > CurvePolyToWorldTransformer
Point missing before and now it is not missing.
virtual void WriteCLI(std::vector< std::string > &vtkNotUsed(commandLine), std::string vtkNotUsed(prefix), int vtkNotUsed(coordinateSystemFlag)=vtkMRMLStorageNode::CoordinateSystemRAS, int vtkNotUsed(multipleFlag)=1)
Simple class for storing standard coded entries (coding scheme, value, meaning triplets) ...
Point is about to be deleted. Thus it is alive when event is called.
Point was not not missing before and now it is missing.
void PrintSelf(ostream &os, vtkIndent indent) override
vtkSmartPointer< vtkParallelTransportFrame > CurveCoordinateSystemGeneratorWorld
std::string ReplaceListNameInMarkupLabelFormat()
virtual int EndModify(int previousDisableModifiedEventState)
End modifying the node.
virtual void CreateDefaultDisplayNodes()
virtual const char * GetIcon()
Existing control point(s) modified, added, or removed. Modified event is NOT invoked.
void RemoveMarkup(int pointIndex)
vtkSmartPointer< vtkGeneralTransform > CurvePolyToWorldTransform
When an interaction with a control point process finishes.
A superclass for other storage nodes.
void SetCenterOfRotationFromArray(const double pos[3])
virtual const char * GetMarkupType()
std::string PropertiesLabelText
Markups node label format changed. Modified event is invoked, too.
vtkCollection * Measurements
List of measurements stored for the markup.
void SetNthControlPointPositionOrientationWorldFromArray(const int pointIndex, const double positionWorld[3], const double orientationMatrix_World[9], const char *associatedNodeID, int positionStatus=PositionDefined)
vtkVector3d CenterOfRotation
vtkMRMLCopyContentMacro(vtkMRMLStorableNode)
When position of the center of rotation is changed (used for example for rotating closed curves)...
vtkCurveGenerator * GetCurveGenerator()
std::string GetNthMarkupID(int n=0)
When starting interacting with a control point.
vtkVector3d GetCenterOfRotationVector()
PositionPreview: new point is being placed, position is tentative.
vtkSmartPointer< vtkPointLocator > TransformedCurvePolyLocator
virtual void UpdateAssignedAttribute()
Node that holds the information about a unit.
New control point(s) added. Modified event is NOT invoked.
virtual const char * GetPlaceAddIcon()
Control point(s) deleted. Modified event is NOT invoked.
std::string AssociatedNodeID
vtkSmartPointer< vtkMatrix4x4 > InteractionHandleToWorldMatrix
Transform that moves the xyz unit vectors and origin of the interaction handles to local coordinates...
virtual void GetRASBounds(double bounds[6])