Slicer 5.4
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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 "vtkSlicerMarkupsModuleMRMLExport.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
66
67class vtkAlgorithmOutput;
68class vtkCollection;
69class vtkDataArray;
70class vtkGeneralTransform;
71class vtkMatrix4x4;
73class vtkPolyData;
74class vtkStringArray;
75class vtkTransformPolyDataFilter;
76
77class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsNode : public vtkMRMLDisplayableNode
78{
83
84public:
85
87 {
89 {
90 // position is 0
91 this->Position[0] = 0.0;
92 this->Position[1] = 0.0;
93 this->Position[2] = 0.0;
94
95 this->OrientationMatrix[0] = 1.0;
96 this->OrientationMatrix[1] = 0.0;
97 this->OrientationMatrix[2] = 0.0;
98
99 this->OrientationMatrix[3] = 0.0;
100 this->OrientationMatrix[4] = 1.0;
101 this->OrientationMatrix[5] = 0.0;
102
103 this->OrientationMatrix[6] = 0.0;
104 this->OrientationMatrix[7] = 0.0;
105 this->OrientationMatrix[8] = 1.0;
106
107 Selected = true;
108 Locked = false;
109 Visibility = true;
110 PositionStatus = PositionUndefined;
111 AutoCreated = false;
112 }
113
114 // Positions and orientation in local coordinates.
115 // If transform is applied to the markup node then world
116 // coordinates may be obtained by applying "to world" transform.
117 double Position[3];
118 // Orientation of control point in 3x3 matrix.
119 // x axis (0, 3, 6), y axis (1, 4, 7), and z axis (2, 5, 8).
120 double OrientationMatrix[9];
121
122 std::string ID;
123 std::string Label;
124 std::string Description;
125 std::string AssociatedNodeID;
126
128 bool Locked;
132 };
133
134 typedef std::vector<ControlPoint*> ControlPointsListType;
135
137
138 void PrintSelf(ostream& os, vtkIndent indent) override;
139
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";}
143
144 //--------------------------------------------------------------------------
145 // MRMLNode methods
146 //--------------------------------------------------------------------------
147
150 virtual const char* GetMarkupType() {return "Markup";};
151
153 virtual const char* GetDefaultNodeNamePrefix() {return "M";};
154
156 void ReadXMLAttributes(const char** atts) override;
157
159 void WriteXML(ostream& of, int indent) override;
160
165 void WriteCLI(std::vector<std::string>& commandLine,
166 std::string prefix, int coordinateSystem = vtkMRMLStorageNode::CoordinateSystemRAS,
167 int multipleFlag = 1) override;
168
172
174 void ProcessMRMLEvents ( vtkObject * /*caller*/,
175 unsigned long /*event*/,
176 void * /*callData*/ ) override;
177
181 int EndModify(int previousDisableModifiedEventState) override;
182
185
188
190
202
206
208
217 void SetNthMeasurement(int id, vtkMRMLMeasurement* measurement);
218 void SetNthMeasurement(int id, const std::string& name, double value, const std::string &units,
219 std::string printFormat = "", const std::string description = "",
220 vtkCodedEntry* quantityCode = nullptr, vtkCodedEntry* derivationCode = nullptr,
221 vtkCodedEntry* unitsCode = nullptr, vtkCodedEntry* methodCode = nullptr);
224
232 enum
233 {
234 LockModifiedEvent = 19000,
238 PointPositionDefinedEvent,
249 };
250
252 enum
253 {
258 PositionStatus_Last
259 };
260
261 static const char* GetPositionStatusAsString(int id);
262 static int GetPositionStatusFromString(const char* name);
263
266 virtual void UnsetAllControlPoints();
267
276 vtkGetMacro(Locked, int);
277 void SetLocked(int locked);
278 vtkBooleanMacro(Locked, int);
280
283
286
292 int GetNumberOfDefinedControlPoints(bool includePreview=false);
294 int GetNumberOfUndefinedControlPoints(bool includePreview = false);
295
299 std::vector<ControlPoint*>* GetControlPoints();
300
308 int AddNControlPoints(int n, std::string label = std::string(), vtkVector3d* point = nullptr);
309 int AddNControlPoints(int n, std::string label, double point[3]);
311
317 void SetControlPointPositionsWorld(vtkPoints* points, bool setUndefinedPoints=true);
318
320 void GetControlPointPositionsWorld(vtkPoints* points);
321
324 int AddControlPoint(vtkVector3d point, std::string label = std::string());
325 int AddControlPoint(double point[3], std::string label = std::string());
326 int AddControlPoint(double x, double y, double z, std::string label = std::string());
328
334 int AddControlPoint(ControlPoint *controlPoint, bool autoLabel=true);
335
339 int AddControlPointWorld(vtkVector3d point, std::string label = std::string());
340 int AddControlPointWorld(double point[3], std::string label = std::string());
341 int AddControlPointWorld(double x, double y, double z, std::string label = std::string());
343
351 bool InsertControlPoint(ControlPoint* controlPoint, int targetIndex);
352 bool InsertControlPoint(int n, vtkVector3d point, std::string label = std::string());
353 bool InsertControlPoint(int n, double point[3], std::string label = std::string());
355
357 //Add and insert control point at index, defined in the world coordinate system.
358 //\sa InsertControlPoint
359 bool InsertControlPointWorld(int n, vtkVector3d pointWorld, std::string label = std::string());
360 bool InsertControlPointWorld(int n, double pointWorld[3], std::string label = std::string());
362
364 void RemoveNthControlPoint(int pointIndex);
365
367 void SwapControlPoints(int m1, int m2);
368
372 void SetNthControlPointAutoCreated(int n, bool flag);
374
378 void GetNthControlPointPosition(int pointIndex, double point[3]);
379 double* GetNthControlPointPosition(int pointIndex) VTK_SIZEHINT(3);
381
384 // Note: this method is not redundant because GetNthControlPointPosition returns a double*
385 // (as it is safe to do so) and so the method that returns a vtkVector3d cannot have the same name.
386 vtkVector3d GetNthControlPointPositionVector(int pointIndex);
387
391 int GetNthControlPointPositionWorld(int pointIndex, double worldxyz[3]);
392 vtkVector3d GetNthControlPointPositionWorld(int pointIndex);
394
395
398 void SetNthControlPointPosition(const int pointIndex, const double x, const double y, const double z, int positionStatus = PositionDefined);
399 void SetNthControlPointPosition(const int pointIndex, const double position[3], int positionStatus = PositionDefined);
401
406 void SetNthControlPointPositionWorld(const int pointIndex, const double x, const double y, const double z, int positionStatus = PositionDefined);
407 void SetNthControlPointPositionWorld(const int pointIndex, const double position[3], int positionStatus = PositionDefined);
409
414 const double pos[3], const double orientationMatrix[9], const char* associatedNodeID, int positionStatus = PositionDefined);
415
419 void SetNthControlPointOrientation(int n, double w, double x, double y, double z);
420 void SetNthControlPointOrientation(int n, const double wxyz[4]);
422
425 void GetNthControlPointOrientation(int n, double orientationWXYZ[4]);
426
430 double* GetNthControlPointOrientationMatrix(int n) VTK_SIZEHINT(9);
431 void SetNthControlPointOrientationMatrix(int n, double orientationMatrix[9]);
433
436 void GetNthControlPointOrientationMatrix(int n, vtkMatrix3x3* matrix);
437 void SetNthControlPointOrientationMatrix(int n, vtkMatrix3x3* matrix);
439
443 void GetNthControlPointOrientationMatrixWorld(int n, double orientationMatrix[9]);
444 vtkVector<double, 9> GetNthControlPointOrientationMatrixWorld(int n);
445 void SetNthControlPointOrientationMatrixWorld(int n, const double orientationMatrix[9]);
447
450 void GetNthControlPointOrientationMatrixWorld(int n, vtkMatrix3x3* matrix);
451 void SetNthControlPointOrientationMatrixWorld(int n, vtkMatrix3x3* matrix);
453
456
461 int GetNthControlPointIndexByPositionStatus(int pointIndex, int positionStatus);
462
464 void UnsetNthControlPointPosition(int pointIndex);
465
468
471
474
478 vtkVector3d GetCenterOfRotation();
479
483 bool GetCenterOfRotation(double point[3]);
484
488 // \sa GetCenterOfRotation
489 bool GetCenterOfRotationWorld(double worldxyz[3]);
490
494 void SetCenterOfRotation(const double x, const double y, const double z);
495 void SetCenterOfRotation(const double position[3]);
497
501 void SetCenterOfRotationWorld(const double x, const double y, const double z);
502 void SetCenterOfRotationWorld(const double positionWorld[3]);
504
507 void GetNthControlPointNormal(int n, double normal[3]);
508 vtkVector3d GetNthControlPointNormal(int n);
510
513 void GetNthControlPointNormalWorld(int n, double normalWorld[3]);
516
520 void SetNthControlPointAssociatedNodeID(int n, std::string id);
522
524 std::string GetNthControlPointID(int n);
525
528 int GetNthControlPointIndexByID(const char* controlPointID);
530 ControlPoint* GetNthControlPointByID(const char* controlPointID);
531
535 int GetControlPointIndexByID(const char* id);
536 int GetControlPointIndexByLabel(const char* label);
537 int GetControlPointIndexByDescription(const char* description);
539
545 void SetNthControlPointSelected(int n, bool flag);
546
556 void SetNthControlPointLocked(int n, bool flag);
557
561
566
574 void SetNthControlPointVisibility(int n, bool flag);
575
578 std::string GetNthControlPointLabel(int n = 0);
579 void SetNthControlPointLabel(int n, std::string label);
581
583 void GetControlPointLabels(vtkStringArray* labels);
584
588 std::string GetNthControlPointDescription(int n = 0);
589 void SetNthControlPointDescription(int n, std::string description);
591
594 bool CanApplyNonLinearTransforms()const override;
595
598 void ApplyTransform(vtkAbstractTransform* transform) override;
599
609 void SetControlPointLabelFormat(std::string format);
611
617
625 bool GetModifiedSinceRead() override;
626
631
639
643 vtkGetMacro(RequiredNumberOfControlPoints, int);
644
653 vtkGetMacro(MaximumNumberOfControlPoints, int);
654
658 static void ConvertOrientationMatrixToWXYZ(const double orientationMatrix[9], double orientationWXYZ[4]);
659 static void ConvertOrientationWXYZToMatrix(const double orientationWXYZ[4], double orientationMatrix[9]);
661
664 virtual vtkPoints* GetCurvePoints();
665 virtual vtkPoints* GetCurvePointsWorld();
666 virtual vtkPolyData* GetCurve();
667 virtual vtkPolyData* GetCurveWorld();
668 virtual vtkAlgorithmOutput* GetCurveWorldConnection();
670
672 int GetControlPointIndexFromInterpolatedPointIndex(vtkIdType interpolatedPointIndex);
673
675 vtkGetMacro(CurveClosed, bool);
676
680 vtkCurveGenerator* GetCurveGenerator() { return this->CurveGenerator.GetPointer(); };
681
684 vtkParallelTransportFrame* GetCurveCoordinateSystemGeneratorWorld() { return this->CurveCoordinateSystemGeneratorWorld.GetPointer(); };
685
686 void GetRASBounds(double bounds[6]) override;
687 void GetBounds(double bounds[6]) override;
688
691 int GetClosestControlPointIndexToPositionWorld(double pos[3], bool visibleOnly=false);
692
694 virtual vtkMatrix4x4* GetInteractionHandleToWorldMatrix();
695
698 virtual std::string GetPropertiesLabelText();
699
701 vtkMRMLUnitNode* GetUnitNode(const char* quantity);
702
705 virtual void UpdateAssignedAttribute() {};
706
709
720
725 vtkGetMacro(LastUsedControlPointNumber, int);
726 vtkSetMacro(LastUsedControlPointNumber, int);
728
729 //-----------------------------------------------------------
730 // All public methods below are deprecated
731 //
732 // These methods are either deprecated because they use old terms (markup instead of control point),
733 // or include "array", "vector", "pointer" in the name (it is redundant, as input arguments can be
734 // deduced from the type; and return type for vectors is always vtkVectorNd).
735 //
736
739 {
740 vtkWarningMacro("vtkMRMLMarkupsNode::RemoveAllMarkups method is deprecated, please use RemoveAllControlPoints instead");
741 this->RemoveAllControlPoints();
742 };
743
745 bool MarkupExists(int n)
746 {
747 vtkWarningMacro("vtkMRMLMarkupsNode::MarkupExists method is deprecated, please use ControlPointExists instead");
748 return this->ControlPointExists(n);
749 };
750
753 {
754 vtkWarningMacro("vtkMRMLMarkupsNode::GetNumberOfMarkups method is deprecated, please use GetNumberOfControlPoints instead");
755 return this->GetNumberOfControlPoints();
756 };
759 {
760 vtkWarningMacro("vtkMRMLMarkupsNode::GetNumberOfPointsInNthMarkup method is deprecated, please use GetNumberOfControlPoints instead");
761 return this->GetNumberOfControlPoints();
762 };
763
765 vtkVector3d GetMarkupPointVector(int markupIndex, int)
766 {
767 vtkWarningMacro("vtkMRMLMarkupsNode::GetMarkupPointVector method is deprecated, please use GetNthControlPointPositionVector instead");
768 return this->GetNthControlPointPositionVector(markupIndex);
769 };
770
772 void GetMarkupPoint(int markupIndex, int pointIndex, double point[3]);
773
775 void RemoveMarkup(int pointIndex)
776 {
777 vtkWarningMacro("vtkMRMLMarkupsNode::RemoveMarkup method is deprecated, please use RemoveNthControlPoint instead");
778 this->RemoveNthControlPoint(pointIndex);
779 };
780
784 void SetNthControlPointPositionFromPointer(const int pointIndex, const double* pos);
785
788 void SetNthControlPointPositionFromArray(const int pointIndex, const double pos[3], int positionStatus = PositionDefined)
789 {
790 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthControlPointPositionFromArray method is deprecated, please use SetNthControlPointPosition instead");
791 this->SetNthControlPointPosition(pointIndex, pos[0], pos[1], pos[2], positionStatus);
792 }
793
797 void SetNthControlPointPositionWorldFromArray(const int pointIndex, const double pos[3], int positionStatus = PositionDefined);
798
804 const double positionWorld[3], const double orientationMatrix_World[9],
805 const char* associatedNodeID, int positionStatus = PositionDefined)
806 {
807 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthControlPointPositionOrientationWorldFromArray method is deprecated,"
808 << " please use SetNthControlPointPositionOrientationWorld instead");
809 this->SetNthControlPointPositionOrientationWorld(
810 pointIndex, positionWorld, orientationMatrix_World, associatedNodeID, positionStatus);
811 }
812
818 vtkVector4d GetNthControlPointOrientationVector(int pointIndex);
819
824 {
825 vtkWarningMacro("vtkMRMLMarkupsNode::GetCenterOfRotationVector method is deprecated, please use GetCenterOfRotation instead");
826 return this->GetCenterOfRotation();
827 }
828
832 void SetCenterOfRotationFromPointer(const double* pos);
836 void SetCenterOfRotationFromArray(const double pos[3])
837 {
838 vtkWarningMacro("vtkMRMLMarkupsNode::SetCenterOfRotationFromArray method is deprecated, please use SetCenterOfRotation instead");
839 this->SetCenterOfRotation(pos[0], pos[1], pos[2]);
840 }
841
846 void SetNthControlPointOrientationFromPointer(int n, const double* orientationWXYZ);
847 void SetNthControlPointOrientationFromArray(int n, const double orientationWXYZ[4])
848 {
849 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthControlPointOrientationFromArray method is deprecated, please use SetNthControlPointOrientation instead");
850 this->SetNthControlPointOrientation(n, orientationWXYZ[0], orientationWXYZ[1], orientationWXYZ[2], orientationWXYZ[3]);
851 }
853
855 std::string GetNthMarkupAssociatedNodeID(int n = 0)
856 {
857 vtkWarningMacro("vtkMRMLMarkupsNode::GetNthMarkupAssociatedNodeID method is deprecated, please use GetNthControlPointAssociatedNodeID instead");
858 return this->GetNthControlPointAssociatedNodeID(n);
859 };
861 void SetNthMarkupAssociatedNodeID(int n, std::string id)
862 {
863 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthMarkupAssociatedNodeID method is deprecated, please use SetNthControlPointAssociatedNodeID instead");
864 this->SetNthControlPointAssociatedNodeID(n, id);
865 };
866
868 std::string GetNthMarkupID(int n = 0)
869 {
870 vtkWarningMacro("vtkMRMLMarkupsNode::GetNthMarkupID method is deprecated, please use GetNthControlPointID instead");
871 return this->GetNthControlPointID(n);
872 };
873
875 bool GetNthMarkupLocked(int n = 0)
876 {
877 vtkWarningMacro("vtkMRMLMarkupsNode::GetNthMarkupLocked method is deprecated, please use GetNthControlPointLocked instead");
878 return this->GetNthControlPointLocked(n);
879 };
881 void SetNthMarkupLocked(int n, bool flag)
882 {
883 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthMarkupLocked method is deprecated, please use SetNthControlPointLocked instead");
884 this->SetNthControlPointLocked(n, flag);
885 };
886
888 std::string GetNthMarkupLabel(int n = 0)
889 {
890 vtkWarningMacro("vtkMRMLMarkupsNode::GetNthMarkupLabel method is deprecated, please use GetNthControlPointLabel instead");
891 return this->GetNthControlPointLabel(n);
892 };
894 void SetNthMarkupLabel(int n, std::string label)
895 {
896 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthMarkupLabel method is deprecated, please use SetNthControlPointLabel instead");
897 this->SetNthControlPointLabel(n, label);
898 };
901 {
902 vtkWarningMacro("vtkMRMLMarkupsNode::GetMarkupLabelFormat method is deprecated, please use GetControlPointLabelFormat instead");
903 return this->GetControlPointLabelFormat();
904 };
906 void SetMarkupLabelFormat(std::string format)
907 {
908 // Not warning this at the moment as existing scene files will contain the markupLabelFormat attribute name and would warn on load
909 // vtkWarningMacro("vtkMRMLMarkupsNode::SetMarkupLabelFormat method is deprecated, please use SetControlPointLabelFormat instead");
910 return this->SetControlPointLabelFormat(format);
911 };
914 {
915 vtkWarningMacro("vtkMRMLMarkupsNode::ReplaceListNameInMarkupLabelFormat method is deprecated, please use ReplaceListNameInControlPointLabelFormat instead");
916 return this->ReplaceListNameInControlPointLabelFormat();
917 };
918
919protected:
924
925 vtkSmartPointer<vtkStringArray> TextList;
926
932 bool SetControlPointLabelsWorld(vtkStringArray* labels, vtkPoints* points, std::string separator = "");
933
937 ControlPoint* GetNthControlPointCustomLog(int n, const char* failedMethodName);
938
942 void SetNthControlPointID(int n, std::string id);
943
948
949 std::string GenerateControlPointLabel(int controlPointIndex);
950
952
954
958
962
965
968 const double position_Node[3], const double orientationMatrix_Node[9], double orientationMatrix_World[9]);
969
972 const double position_World[3], const double orientationMatrix_World[9], double orientationMatrix_Node[9]);
973
976 int RequiredNumberOfControlPoints{0};
979 int MaximumNumberOfControlPoints{-1};
980
981 bool CurveClosed{false};
982
985
987 vtkSmartPointer<vtkCurveGenerator> CurveGenerator;
988
993 vtkSmartPointer<vtkParallelTransportFrame> CurveCoordinateSystemGeneratorWorld;
994
997 vtkSmartPointer<vtkPolyData> CurveInputPoly;
998
999 vtkSmartPointer<vtkTransformPolyDataFilter> CurvePolyToWorldTransformer;
1000 vtkSmartPointer<vtkGeneralTransform> CurvePolyToWorldTransform;
1001
1004 vtkSmartPointer<vtkPointLocator> TransformedCurvePolyLocator;
1005
1007 int Locked{0};
1008
1011 bool FixedNumberOfControlPoints{false};
1012
1013 std::string ControlPointLabelFormat{"%N-%d"};
1014
1018 int LastUsedControlPointNumber{0};
1019
1021 int ControlPointPlacementStartIndex{ -1 };
1022
1025 vtkVector3d CenterOfRotation;
1026
1028 vtkCollection* Measurements;
1029
1031
1033 vtkSmartPointer<vtkMatrix4x4> InteractionHandleToWorldMatrix;
1034
1036 bool IsUpdatingPoints{false};
1037
1038 friend class qSlicerMarkupsModuleWidget; // To directly access measurements
1039};
1040
1041#endif
Simple class for storing standard coded entries (coding scheme, value, meaning triplets)
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)
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)
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)
ControlPoint * GetNthControlPointCustomLog(int n, const char *failedMethodName)
std::string GetControlPointLabelFormat()
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)
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])
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)
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)
int GetControlPointIndexByDescription(const char *description)
vtkVector3d GetNthControlPointNormal(int n)
@ PointRemovedEvent
Control point(s) deleted. Modified event is NOT invoked.
@ PointPositionNonMissingEvent
Point missing before and now it is not missing.
@ 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.
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.
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()
Get markup short name.
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).
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)
std::vector< ControlPoint * > * GetControlPoints()
Return a pointer to the std::vector of control points stored in this node.
void SetNthControlPointOrientationMatrixWorld(int n, vtkMatrix3x3 *matrix)
@ 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.
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])
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.