Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
vtkMRMLMarkupsNode.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16==============================================================================*/
17
18#ifndef __vtkMRMLMarkupsNode_h
19#define __vtkMRMLMarkupsNode_h
20
21// MRML includes
23#include "vtkCurveGenerator.h"
24#include "vtkMRMLMeasurement.h"
26
27// Markups includes
28#include "vtkMRMLExport.h"
29
30// VTK includes
31#include <vtkParallelTransportFrame.h>
32#include <vtkPointLocator.h>
33#include <vtkSmartPointer.h>
34#include <vtkVector.h>
35
36class vtkMatrix3x3;
37class vtkMRMLUnitNode;
38
65
66class vtkAlgorithmOutput;
67class vtkCollection;
68class vtkDataArray;
69class vtkGeneralTransform;
70class vtkMatrix4x4;
72class vtkPolyData;
73class vtkStringArray;
74class vtkTransformPolyDataFilter;
75
76class VTK_MRML_EXPORT vtkMRMLMarkupsNode : public vtkMRMLDisplayableNode
77{
82
83public:
84
86 {
88 {
89 // position is 0
90 this->Position[0] = 0.0;
91 this->Position[1] = 0.0;
92 this->Position[2] = 0.0;
93
94 this->OrientationMatrix[0] = 1.0;
95 this->OrientationMatrix[1] = 0.0;
96 this->OrientationMatrix[2] = 0.0;
97
98 this->OrientationMatrix[3] = 0.0;
99 this->OrientationMatrix[4] = 1.0;
100 this->OrientationMatrix[5] = 0.0;
101
102 this->OrientationMatrix[6] = 0.0;
103 this->OrientationMatrix[7] = 0.0;
104 this->OrientationMatrix[8] = 1.0;
105
106 Selected = true;
107 Locked = false;
108 Visibility = true;
110 AutoCreated = false;
111 }
112
113 // Positions and orientation in local coordinates.
114 // If transform is applied to the markup node then world
115 // coordinates may be obtained by applying "to world" transform.
116 double Position[3];
117 // Orientation of control point in 3x3 matrix.
118 // x axis (0, 3, 6), y axis (1, 4, 7), and z axis (2, 5, 8).
120
121 std::string ID;
122 std::string Label;
123 std::string Description;
124 std::string AssociatedNodeID;
125
127 bool Locked;
131 };
132
133 typedef std::vector<ControlPoint*> ControlPointsListType;
134
136
137 void PrintSelf(ostream& os, vtkIndent indent) override;
138
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";}
142
143 //--------------------------------------------------------------------------
144 // MRMLNode methods
145 //--------------------------------------------------------------------------
146
149 virtual const char* GetMarkupType() {return "Markup";};
150
153 virtual const char* GetDefaultNodeNamePrefix();
154
157 virtual const char* GetTypeDisplayName() override;
158
160 void ReadXMLAttributes(const char** atts) override;
161
163 void WriteXML(ostream& of, int indent) override;
164
169 void WriteCLI(std::vector<std::string>& commandLine,
170 std::string prefix, int coordinateSystem = vtkMRMLStorageNode::CoordinateSystemRAS,
171 int multipleFlag = 1) override;
172
176
178 void ProcessMRMLEvents ( vtkObject * /*caller*/,
179 unsigned long /*event*/,
180 void * /*callData*/ ) override;
181
185 int EndModify(int previousDisableModifiedEventState) override;
186
189
192
194
206
210
212
221 void SetNthMeasurement(int id, vtkMRMLMeasurement* measurement);
222 void SetNthMeasurement(int id, const std::string& name, double value, const std::string &units,
223 std::string printFormat = "", const std::string description = "",
224 vtkCodedEntry* quantityCode = nullptr, vtkCodedEntry* derivationCode = nullptr,
225 vtkCodedEntry* unitsCode = nullptr, vtkCodedEntry* methodCode = nullptr);
228
236 enum
237 {
253 };
254
256 enum
257 {
263 };
264
265 static const char* GetPositionStatusAsString(int id);
266 static int GetPositionStatusFromString(const char* name);
267
270 virtual void UnsetAllControlPoints();
271
280 vtkGetMacro(Locked, int);
281 void SetLocked(int locked);
282 vtkBooleanMacro(Locked, int);
284
287
290
296 int GetNumberOfDefinedControlPoints(bool includePreview=false);
298 int GetNumberOfUndefinedControlPoints(bool includePreview = false);
299
303 std::vector<ControlPoint*>* GetControlPoints();
304
312 int AddNControlPoints(int n, std::string label = std::string(), vtkVector3d* point = nullptr);
313 int AddNControlPoints(int n, std::string label, double point[3]);
315
321 void SetControlPointPositionsWorld(vtkPoints* points, bool setUndefinedPoints=true);
322
324 void GetControlPointPositionsWorld(vtkPoints* points);
325
328 int AddControlPoint(vtkVector3d point, std::string label = std::string());
329 int AddControlPoint(double point[3], std::string label = std::string());
330 int AddControlPoint(double x, double y, double z, std::string label = std::string());
332
338 int AddControlPoint(ControlPoint *controlPoint, bool autoLabel=true);
339
343 int AddControlPointWorld(vtkVector3d point, std::string label = std::string());
344 int AddControlPointWorld(double point[3], std::string label = std::string());
345 int AddControlPointWorld(double x, double y, double z, std::string label = std::string());
347
355 bool InsertControlPoint(ControlPoint* controlPoint, int targetIndex);
356 bool InsertControlPoint(int n, vtkVector3d point, std::string label = std::string());
357 bool InsertControlPoint(int n, double point[3], std::string label = std::string());
359
361 //Add and insert control point at index, defined in the world coordinate system.
362 //\sa InsertControlPoint
363 bool InsertControlPointWorld(int n, vtkVector3d pointWorld, std::string label = std::string());
364 bool InsertControlPointWorld(int n, double pointWorld[3], std::string label = std::string());
366
368 void RemoveNthControlPoint(int pointIndex);
369
371 void SwapControlPoints(int m1, int m2);
372
376 void SetNthControlPointAutoCreated(int n, bool flag);
378
382 void GetNthControlPointPosition(int pointIndex, double point[3]);
383 double* GetNthControlPointPosition(int pointIndex) VTK_SIZEHINT(3);
385
388 // Note: this method is not redundant because GetNthControlPointPosition returns a double*
389 // (as it is safe to do so) and so the method that returns a vtkVector3d cannot have the same name.
390 vtkVector3d GetNthControlPointPositionVector(int pointIndex);
391
395 int GetNthControlPointPositionWorld(int pointIndex, double worldxyz[3]);
396 vtkVector3d GetNthControlPointPositionWorld(int pointIndex);
398
399
402 void SetNthControlPointPosition(const int pointIndex, const double x, const double y, const double z, int positionStatus = PositionDefined);
403 void SetNthControlPointPosition(const int pointIndex, const double position[3], int positionStatus = PositionDefined);
405
410 void SetNthControlPointPositionWorld(const int pointIndex, const double x, const double y, const double z, int positionStatus = PositionDefined);
411 void SetNthControlPointPositionWorld(const int pointIndex, const double position[3], int positionStatus = PositionDefined);
413
418 const double pos[3], const double orientationMatrix[9], const char* associatedNodeID, int positionStatus = PositionDefined);
419
423 void SetNthControlPointOrientation(int n, double w, double x, double y, double z);
424 void SetNthControlPointOrientation(int n, const double wxyz[4]);
426
429 void GetNthControlPointOrientation(int n, double orientationWXYZ[4]);
430
434 double* GetNthControlPointOrientationMatrix(int n) VTK_SIZEHINT(9);
435 void SetNthControlPointOrientationMatrix(int n, double orientationMatrix[9]);
437
440 void GetNthControlPointOrientationMatrix(int n, vtkMatrix3x3* matrix);
441 void SetNthControlPointOrientationMatrix(int n, vtkMatrix3x3* matrix);
443
447 void GetNthControlPointOrientationMatrixWorld(int n, double orientationMatrix[9]);
448 vtkVector<double, 9> GetNthControlPointOrientationMatrixWorld(int n);
449 void SetNthControlPointOrientationMatrixWorld(int n, const double orientationMatrix[9]);
451
454 void GetNthControlPointOrientationMatrixWorld(int n, vtkMatrix3x3* matrix);
455 void SetNthControlPointOrientationMatrixWorld(int n, vtkMatrix3x3* matrix);
457
460
465 int GetNthControlPointIndexByPositionStatus(int pointIndex, int positionStatus);
466
468 void UnsetNthControlPointPosition(int pointIndex);
469
472
475
478
482 vtkVector3d GetCenterOfRotation();
483
487 bool GetCenterOfRotation(double point[3]);
488
492 // \sa GetCenterOfRotation
493 bool GetCenterOfRotationWorld(double worldxyz[3]);
494
498 void SetCenterOfRotation(const double x, const double y, const double z);
499 void SetCenterOfRotation(const double position[3]);
501
505 void SetCenterOfRotationWorld(const double x, const double y, const double z);
506 void SetCenterOfRotationWorld(const double positionWorld[3]);
508
511 void GetNthControlPointNormal(int n, double normal[3]);
512 vtkVector3d GetNthControlPointNormal(int n);
514
517 void GetNthControlPointNormalWorld(int n, double normalWorld[3]);
520
524 void SetNthControlPointAssociatedNodeID(int n, std::string id);
526
528 std::string GetNthControlPointID(int n);
529
532 int GetNthControlPointIndexByID(const char* controlPointID);
534 ControlPoint* GetNthControlPointByID(const char* controlPointID);
535
539 int GetControlPointIndexByID(const char* id);
540 int GetControlPointIndexByLabel(const char* label);
541 int GetControlPointIndexByDescription(const char* description);
543
549 void SetNthControlPointSelected(int n, bool flag);
550
560 void SetNthControlPointLocked(int n, bool flag);
561
565
570
578 void SetNthControlPointVisibility(int n, bool flag);
579
582 std::string GetNthControlPointLabel(int n = 0);
583 void SetNthControlPointLabel(int n, std::string label);
585
587 void GetControlPointLabels(vtkStringArray* labels);
588
592 std::string GetNthControlPointDescription(int n = 0);
593 void SetNthControlPointDescription(int n, std::string description);
595
598 bool CanApplyNonLinearTransforms()const override;
599
602 void ApplyTransform(vtkAbstractTransform* transform) override;
603 virtual void ApplyTransform(vtkAbstractTransform* transform, bool applyToLockedControlPoints);
604
614 void SetControlPointLabelFormat(std::string format);
616
622
630 bool GetModifiedSinceRead() override;
631
636
644
649
659
663 static void ConvertOrientationMatrixToWXYZ(const double orientationMatrix[9], double orientationWXYZ[4]);
664 static void ConvertOrientationWXYZToMatrix(const double orientationWXYZ[4], double orientationMatrix[9]);
666
669 virtual vtkPoints* GetCurvePoints();
670 virtual vtkPoints* GetCurvePointsWorld();
671 virtual vtkPolyData* GetCurve();
672 virtual vtkPolyData* GetCurveWorld();
673 virtual vtkAlgorithmOutput* GetCurveWorldConnection();
675
677 int GetControlPointIndexFromInterpolatedPointIndex(vtkIdType interpolatedPointIndex);
678
680 vtkGetMacro(CurveClosed, bool);
681
685 vtkCurveGenerator* GetCurveGenerator() { return this->CurveGenerator.GetPointer(); };
686
689 vtkParallelTransportFrame* GetCurveCoordinateSystemGeneratorWorld() { return this->CurveCoordinateSystemGeneratorWorld.GetPointer(); };
690
691 void GetRASBounds(double bounds[6]) override;
692 void GetBounds(double bounds[6]) override;
693
696 int GetClosestControlPointIndexToPositionWorld(double pos[3], bool visibleOnly=false);
697
699 virtual vtkMatrix4x4* GetInteractionHandleToWorldMatrix();
700
703 virtual std::string GetPropertiesLabelText();
704
706 vtkMRMLUnitNode* GetUnitNode(const char* quantity);
707
710 virtual void UpdateAssignedAttribute() {};
711
714
725
730 vtkGetMacro(LastUsedControlPointNumber, int);
731 vtkSetMacro(LastUsedControlPointNumber, int);
733
734 //-----------------------------------------------------------
735 // All public methods below are deprecated
736 //
737 // These methods are either deprecated because they use old terms (markup instead of control point),
738 // or include "array", "vector", "pointer" in the name (it is redundant, as input arguments can be
739 // deduced from the type; and return type for vectors is always vtkVectorNd).
740 //
741
744 {
745 vtkWarningMacro("vtkMRMLMarkupsNode::RemoveAllMarkups method is deprecated, please use RemoveAllControlPoints instead");
747 };
748
750 bool MarkupExists(int n)
751 {
752 vtkWarningMacro("vtkMRMLMarkupsNode::MarkupExists method is deprecated, please use ControlPointExists instead");
753 return this->ControlPointExists(n);
754 };
755
758 {
759 vtkWarningMacro("vtkMRMLMarkupsNode::GetNumberOfMarkups method is deprecated, please use GetNumberOfControlPoints instead");
760 return this->GetNumberOfControlPoints();
761 };
762
764 {
765 vtkWarningMacro("vtkMRMLMarkupsNode::GetNumberOfPointsInNthMarkup method is deprecated, please use GetNumberOfControlPoints instead");
766 return this->GetNumberOfControlPoints();
767 };
768
770 vtkVector3d GetMarkupPointVector(int markupIndex, int)
771 {
772 vtkWarningMacro("vtkMRMLMarkupsNode::GetMarkupPointVector method is deprecated, please use GetNthControlPointPositionVector instead");
773 return this->GetNthControlPointPositionVector(markupIndex);
774 };
775
777 void GetMarkupPoint(int markupIndex, int pointIndex, double point[3]);
778
780 void RemoveMarkup(int pointIndex)
781 {
782 vtkWarningMacro("vtkMRMLMarkupsNode::RemoveMarkup method is deprecated, please use RemoveNthControlPoint instead");
783 this->RemoveNthControlPoint(pointIndex);
784 };
785
789 void SetNthControlPointPositionFromPointer(const int pointIndex, const double* pos);
790
793 void SetNthControlPointPositionFromArray(const int pointIndex, const double pos[3], int positionStatus = PositionDefined)
794 {
795 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthControlPointPositionFromArray method is deprecated, please use SetNthControlPointPosition instead");
796 this->SetNthControlPointPosition(pointIndex, pos[0], pos[1], pos[2], positionStatus);
797 }
798
802 void SetNthControlPointPositionWorldFromArray(const int pointIndex, const double pos[3], int positionStatus = PositionDefined);
803
809 const double positionWorld[3], const double orientationMatrix_World[9],
810 const char* associatedNodeID, int positionStatus = PositionDefined)
811 {
812 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthControlPointPositionOrientationWorldFromArray method is deprecated,"
813 << " please use SetNthControlPointPositionOrientationWorld instead");
815 pointIndex, positionWorld, orientationMatrix_World, associatedNodeID, positionStatus);
816 }
817
823 vtkVector4d GetNthControlPointOrientationVector(int pointIndex);
824
829 {
830 vtkWarningMacro("vtkMRMLMarkupsNode::GetCenterOfRotationVector method is deprecated, please use GetCenterOfRotation instead");
831 return this->GetCenterOfRotation();
832 }
833
837 void SetCenterOfRotationFromPointer(const double* pos);
841 void SetCenterOfRotationFromArray(const double pos[3])
842 {
843 vtkWarningMacro("vtkMRMLMarkupsNode::SetCenterOfRotationFromArray method is deprecated, please use SetCenterOfRotation instead");
844 this->SetCenterOfRotation(pos[0], pos[1], pos[2]);
845 }
846
851 void SetNthControlPointOrientationFromPointer(int n, const double* orientationWXYZ);
852 void SetNthControlPointOrientationFromArray(int n, const double orientationWXYZ[4])
853 {
854 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthControlPointOrientationFromArray method is deprecated, please use SetNthControlPointOrientation instead");
855 this->SetNthControlPointOrientation(n, orientationWXYZ[0], orientationWXYZ[1], orientationWXYZ[2], orientationWXYZ[3]);
856 }
857
858
860 std::string GetNthMarkupAssociatedNodeID(int n = 0)
861 {
862 vtkWarningMacro("vtkMRMLMarkupsNode::GetNthMarkupAssociatedNodeID method is deprecated, please use GetNthControlPointAssociatedNodeID instead");
864 };
865
866 void SetNthMarkupAssociatedNodeID(int n, std::string id)
867 {
868 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthMarkupAssociatedNodeID method is deprecated, please use SetNthControlPointAssociatedNodeID instead");
870 };
871
873 std::string GetNthMarkupID(int n = 0)
874 {
875 vtkWarningMacro("vtkMRMLMarkupsNode::GetNthMarkupID method is deprecated, please use GetNthControlPointID instead");
876 return this->GetNthControlPointID(n);
877 };
878
880 bool GetNthMarkupLocked(int n = 0)
881 {
882 vtkWarningMacro("vtkMRMLMarkupsNode::GetNthMarkupLocked method is deprecated, please use GetNthControlPointLocked instead");
883 return this->GetNthControlPointLocked(n);
884 };
885
886 void SetNthMarkupLocked(int n, bool flag)
887 {
888 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthMarkupLocked method is deprecated, please use SetNthControlPointLocked instead");
889 this->SetNthControlPointLocked(n, flag);
890 };
891
893 std::string GetNthMarkupLabel(int n = 0)
894 {
895 vtkWarningMacro("vtkMRMLMarkupsNode::GetNthMarkupLabel method is deprecated, please use GetNthControlPointLabel instead");
896 return this->GetNthControlPointLabel(n);
897 };
898
899 void SetNthMarkupLabel(int n, std::string label)
900 {
901 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthMarkupLabel method is deprecated, please use SetNthControlPointLabel instead");
902 this->SetNthControlPointLabel(n, label);
903 };
904
906 {
907 vtkWarningMacro("vtkMRMLMarkupsNode::GetMarkupLabelFormat method is deprecated, please use GetControlPointLabelFormat instead");
908 return this->GetControlPointLabelFormat();
909 };
910
911 void SetMarkupLabelFormat(std::string format)
912 {
913 // Not warning this at the moment as existing scene files will contain the markupLabelFormat attribute name and would warn on load
914 // vtkWarningMacro("vtkMRMLMarkupsNode::SetMarkupLabelFormat method is deprecated, please use SetControlPointLabelFormat instead");
915 return this->SetControlPointLabelFormat(format);
916 };
917
919 {
920 vtkWarningMacro("vtkMRMLMarkupsNode::ReplaceListNameInMarkupLabelFormat method is deprecated, please use ReplaceListNameInControlPointLabelFormat instead");
922 };
923
924protected:
929
930 vtkSmartPointer<vtkStringArray> TextList;
931
937 bool SetControlPointLabelsWorld(vtkStringArray* labels, vtkPoints* points, std::string separator = "");
938
942 ControlPoint* GetNthControlPointCustomLog(int n, const char* failedMethodName);
943
947 void SetNthControlPointID(int n, std::string id);
948
953
954 std::string GenerateControlPointLabel(int controlPointIndex);
955
957
959
963
967
970
973 const double position_Node[3], const double orientationMatrix_Node[9], double orientationMatrix_World[9]);
974
977 const double position_World[3], const double orientationMatrix_World[9], double orientationMatrix_Node[9]);
978
985
986 bool CurveClosed{false};
987
990
992 vtkSmartPointer<vtkCurveGenerator> CurveGenerator;
993
998 vtkSmartPointer<vtkParallelTransportFrame> CurveCoordinateSystemGeneratorWorld;
999
1002 vtkSmartPointer<vtkPolyData> CurveInputPoly;
1003
1004 vtkSmartPointer<vtkTransformPolyDataFilter> CurvePolyToWorldTransformer;
1005 vtkSmartPointer<vtkGeneralTransform> CurvePolyToWorldTransform;
1006
1009 vtkSmartPointer<vtkPointLocator> TransformedCurvePolyLocator;
1010
1012 int Locked{0};
1013
1017
1018 std::string ControlPointLabelFormat{"%N-%d"};
1019
1024
1027
1030 vtkVector3d CenterOfRotation;
1031
1033 vtkCollection* Measurements;
1034
1036
1038 std::string TypeDisplayName;
1039
1042
1044 vtkSmartPointer<vtkMatrix4x4> InteractionHandleToWorldMatrix;
1045
1047 bool IsUpdatingPoints{false};
1048
1049 friend class qSlicerMarkupsModuleWidget; // To directly access measurements
1050};
1051
1052#endif
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)
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 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.
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())
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()
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)
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])
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.
MRML node for representing a transformation between this node space and a parent node space.
Node that holds the information about a unit.