Slicer 5.9
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 "vtkMRMLExport.h"
29
30// VTK includes
31#include <vtkParallelTransportFrame.h>
32#include <vtkPointLocator.h>
33#include <vtkSmartPointer.h>
34#include <vtkVector.h>
35
36// VTK 9.3 does not have VTK_PROPEXCLUDE
37#ifndef VTK_PROPEXCLUDE
38 #define VTK_PROPEXCLUDE
39#endif
40
41class vtkMatrix3x3;
42class vtkMRMLUnitNode;
43
70
71class vtkAlgorithmOutput;
72class vtkCollection;
73class vtkDataArray;
74class vtkGeneralTransform;
75class vtkMatrix4x4;
77class vtkPolyData;
78class vtkStringArray;
79class vtkTransformPolyDataFilter;
80
81class VTK_MRML_EXPORT vtkMRMLMarkupsNode : public vtkMRMLDisplayableNode
82{
87
88public:
89
91 {
93 {
94 // position is 0
95 this->Position[0] = 0.0;
96 this->Position[1] = 0.0;
97 this->Position[2] = 0.0;
98
99 this->OrientationMatrix[0] = 1.0;
100 this->OrientationMatrix[1] = 0.0;
101 this->OrientationMatrix[2] = 0.0;
102
103 this->OrientationMatrix[3] = 0.0;
104 this->OrientationMatrix[4] = 1.0;
105 this->OrientationMatrix[5] = 0.0;
106
107 this->OrientationMatrix[6] = 0.0;
108 this->OrientationMatrix[7] = 0.0;
109 this->OrientationMatrix[8] = 1.0;
110
111 Selected = true;
112 Locked = false;
113 Visibility = true;
115 AutoCreated = false;
116 }
117
118 // Positions and orientation in local coordinates.
119 // If transform is applied to the markup node then world
120 // coordinates may be obtained by applying "to world" transform.
121 double Position[3];
122 // Orientation of control point in 3x3 matrix.
123 // x axis (0, 3, 6), y axis (1, 4, 7), and z axis (2, 5, 8).
125
126 std::string ID;
127 std::string Label;
128 std::string Description;
129 std::string AssociatedNodeID;
130
132 bool Locked;
136 };
137
138 typedef std::vector<ControlPoint*> ControlPointsListType;
139
141
142 void PrintSelf(ostream& os, vtkIndent indent) override;
143
144 virtual const char* GetIcon() {return ":/Icons/MarkupsGeneric.png";}
145 virtual const char* GetAddIcon() {return ":/Icons/MarkupsGenericMouseModePlace.png";}
146 virtual const char* GetPlaceAddIcon() {return ":/Icons/MarkupsGenericMouseModePlaceAdd.png";}
147
148 //--------------------------------------------------------------------------
149 // MRMLNode methods
150 //--------------------------------------------------------------------------
151
154 virtual const char* GetMarkupType() {return "Markup";};
155
158 virtual const char* GetDefaultNodeNamePrefix();
159
162 virtual const char* GetTypeDisplayName() override;
163
165 void ReadXMLAttributes(const char** atts) override;
166
168 void WriteXML(ostream& of, int indent) override;
169
174 void WriteCLI(std::vector<std::string>& commandLine,
175 std::string prefix, int coordinateSystem = vtkMRMLStorageNode::CoordinateSystemRAS,
176 int multipleFlag = 1) override;
177
181
183 void ProcessMRMLEvents ( vtkObject * /*caller*/,
184 unsigned long /*event*/,
185 void * /*callData*/ ) override;
186
190 int EndModify(int previousDisableModifiedEventState) override;
191
194
197
199
211
215
217
226 void SetNthMeasurement(int id, vtkMRMLMeasurement* measurement);
227 void SetNthMeasurement(int id, const std::string& name, double value, const std::string &units,
228 std::string printFormat = "", const std::string description = "",
229 vtkCodedEntry* quantityCode = nullptr, vtkCodedEntry* derivationCode = nullptr,
230 vtkCodedEntry* unitsCode = nullptr, vtkCodedEntry* methodCode = nullptr);
233
241 enum
242 {
258 };
259
261 enum
262 {
268 };
269
270 static const char* GetPositionStatusAsString(int id);
271 static int GetPositionStatusFromString(const char* name);
272
275 virtual void UnsetAllControlPoints();
276
285 vtkGetMacro(Locked, int);
286 void SetLocked(int locked);
287 vtkBooleanMacro(Locked, int);
289
292
295
301 int GetNumberOfDefinedControlPoints(bool includePreview=false);
303 int GetNumberOfUndefinedControlPoints(bool includePreview = false);
304
308 std::vector<ControlPoint*>* GetControlPoints();
309
317 int AddNControlPoints(int n, std::string label = std::string(), vtkVector3d* point = nullptr);
318 int AddNControlPoints(int n, std::string label, double point[3]);
320
326 void SetControlPointPositionsWorld(vtkPoints* points, bool setUndefinedPoints=true);
327
329 void GetControlPointPositionsWorld(vtkPoints* points);
330
333 int AddControlPoint(vtkVector3d point, std::string label = std::string());
334 int AddControlPoint(double point[3], std::string label = std::string());
335 int AddControlPoint(double x, double y, double z, std::string label = std::string());
337
343 int AddControlPoint(ControlPoint *controlPoint, bool autoLabel=true);
344
348 int AddControlPointWorld(vtkVector3d point, std::string label = std::string());
349 int AddControlPointWorld(double point[3], std::string label = std::string());
350 int AddControlPointWorld(double x, double y, double z, std::string label = std::string());
352
360 bool InsertControlPoint(ControlPoint* controlPoint, int targetIndex);
361 bool InsertControlPoint(int n, vtkVector3d point, std::string label = std::string());
362 bool InsertControlPoint(int n, double point[3], std::string label = std::string());
364
366 //Add and insert control point at index, defined in the world coordinate system.
367 //\sa InsertControlPoint
368 bool InsertControlPointWorld(int n, vtkVector3d pointWorld, std::string label = std::string());
369 bool InsertControlPointWorld(int n, double pointWorld[3], std::string label = std::string());
371
373 void RemoveNthControlPoint(int pointIndex);
374
376 void SwapControlPoints(int m1, int m2);
377
381 void SetNthControlPointAutoCreated(int n, bool flag);
383
387 void GetNthControlPointPosition(int pointIndex, double point[3]);
388 double* GetNthControlPointPosition(int pointIndex) VTK_SIZEHINT(3);
390
393 // Note: this method is not redundant because GetNthControlPointPosition returns a double*
394 // (as it is safe to do so) and so the method that returns a vtkVector3d cannot have the same name.
395 vtkVector3d GetNthControlPointPositionVector(int pointIndex);
396
400 int GetNthControlPointPositionWorld(int pointIndex, double worldxyz[3]);
401 vtkVector3d GetNthControlPointPositionWorld(int pointIndex);
403
404
407 void SetNthControlPointPosition(const int pointIndex, const double x, const double y, const double z, int positionStatus = PositionDefined);
408 void SetNthControlPointPosition(const int pointIndex, const double position[3], int positionStatus = PositionDefined);
410
415 void SetNthControlPointPositionWorld(const int pointIndex, const double x, const double y, const double z, int positionStatus = PositionDefined);
416 void SetNthControlPointPositionWorld(const int pointIndex, const double position[3], int positionStatus = PositionDefined);
418
423 const double pos[3], const double orientationMatrix[9], const char* associatedNodeID, int positionStatus = PositionDefined);
424
428 void SetNthControlPointOrientation(int n, double w, double x, double y, double z);
429 void SetNthControlPointOrientation(int n, const double wxyz[4]);
431
434 void GetNthControlPointOrientation(int n, double orientationWXYZ[4]);
435
439 double* GetNthControlPointOrientationMatrix(int n) VTK_SIZEHINT(9);
440 void SetNthControlPointOrientationMatrix(int n, double orientationMatrix[9]);
442
445 void GetNthControlPointOrientationMatrix(int n, vtkMatrix3x3* matrix);
446 void SetNthControlPointOrientationMatrix(int n, vtkMatrix3x3* matrix);
448
452 void GetNthControlPointOrientationMatrixWorld(int n, double orientationMatrix[9]);
453 vtkVector<double, 9> GetNthControlPointOrientationMatrixWorld(int n);
454 void SetNthControlPointOrientationMatrixWorld(int n, const double orientationMatrix[9]);
456
459 void GetNthControlPointOrientationMatrixWorld(int n, vtkMatrix3x3* matrix);
460 void SetNthControlPointOrientationMatrixWorld(int n, vtkMatrix3x3* matrix);
462
465
470 int GetNthControlPointIndexByPositionStatus(int pointIndex, int positionStatus);
471
473 void UnsetNthControlPointPosition(int pointIndex);
474
477
480
483
487 vtkVector3d GetCenterOfRotation();
488
492 bool GetCenterOfRotation(double point[3]);
493
497 // \sa GetCenterOfRotation
498 bool GetCenterOfRotationWorld(double worldxyz[3]);
499
503 void SetCenterOfRotation(const double x, const double y, const double z);
504 void SetCenterOfRotation(const double position[3]);
506
510 void SetCenterOfRotationWorld(const double x, const double y, const double z);
511 void SetCenterOfRotationWorld(const double positionWorld[3]);
513
516 void GetNthControlPointNormal(int n, double normal[3]);
517 vtkVector3d GetNthControlPointNormal(int n);
519
522 void GetNthControlPointNormalWorld(int n, double normalWorld[3]);
525
529 void SetNthControlPointAssociatedNodeID(int n, std::string id);
531
533 std::string GetNthControlPointID(int n);
534
537 int GetNthControlPointIndexByID(const char* controlPointID);
539 ControlPoint* GetNthControlPointByID(const char* controlPointID);
540
544 int GetControlPointIndexByID(const char* id);
545 int GetControlPointIndexByLabel(const char* label);
546 int GetControlPointIndexByDescription(const char* description);
548
554 void SetNthControlPointSelected(int n, bool flag);
555
565 void SetNthControlPointLocked(int n, bool flag);
566
570
575
583 void SetNthControlPointVisibility(int n, bool flag);
584
587 std::string GetNthControlPointLabel(int n = 0);
588 void SetNthControlPointLabel(int n, std::string label);
590
592 void GetControlPointLabels(vtkStringArray* labels);
593
597 std::string GetNthControlPointDescription(int n = 0);
598 void SetNthControlPointDescription(int n, std::string description);
600
603 bool CanApplyNonLinearTransforms()const override;
604
607 void ApplyTransform(vtkAbstractTransform* transform) override;
608 virtual void ApplyTransform(vtkAbstractTransform* transform, bool applyToLockedControlPoints);
609
619 void SetControlPointLabelFormat(std::string format);
621
627
635 bool GetModifiedSinceRead() override;
636
641
649
654
664
668 static void ConvertOrientationMatrixToWXYZ(const double orientationMatrix[9], double orientationWXYZ[4]);
669 static void ConvertOrientationWXYZToMatrix(const double orientationWXYZ[4], double orientationMatrix[9]);
671
674 virtual vtkPoints* GetCurvePoints();
675 virtual vtkPoints* GetCurvePointsWorld();
676 virtual vtkPolyData* GetCurve();
677 virtual vtkPolyData* GetCurveWorld();
678 virtual vtkAlgorithmOutput* GetCurveWorldConnection();
680
682 int GetControlPointIndexFromInterpolatedPointIndex(vtkIdType interpolatedPointIndex);
683
685 vtkGetMacro(CurveClosed, bool);
686
690 vtkCurveGenerator* GetCurveGenerator() { return this->CurveGenerator.GetPointer(); };
691
694 vtkParallelTransportFrame* GetCurveCoordinateSystemGeneratorWorld() { return this->CurveCoordinateSystemGeneratorWorld.GetPointer(); };
695
696 void GetRASBounds(double bounds[6]) override;
697 void GetBounds(double bounds[6]) override;
698
701 int GetClosestControlPointIndexToPositionWorld(double pos[3], bool visibleOnly=false);
702
704 virtual vtkMatrix4x4* GetInteractionHandleToWorldMatrix();
705
708 virtual std::string GetPropertiesLabelText();
709
711 vtkMRMLUnitNode* GetUnitNode(const char* quantity);
712
715 virtual void UpdateAssignedAttribute() {};
716
719
730
735 vtkGetMacro(LastUsedControlPointNumber, int);
736 vtkSetMacro(LastUsedControlPointNumber, int);
738
739 //-----------------------------------------------------------
740 // All public methods below are deprecated
741 //
742 // These methods are either deprecated because they use old terms (markup instead of control point),
743 // or include "array", "vector", "pointer" in the name (it is redundant, as input arguments can be
744 // deduced from the type; and return type for vectors is always vtkVectorNd).
745 //
746
749 {
750 vtkWarningMacro("vtkMRMLMarkupsNode::RemoveAllMarkups method is deprecated, please use RemoveAllControlPoints instead");
752 };
753
755 bool MarkupExists(int n)
756 {
757 vtkWarningMacro("vtkMRMLMarkupsNode::MarkupExists method is deprecated, please use ControlPointExists instead");
758 return this->ControlPointExists(n);
759 };
760
763 {
764 vtkWarningMacro("vtkMRMLMarkupsNode::GetNumberOfMarkups method is deprecated, please use GetNumberOfControlPoints instead");
765 return this->GetNumberOfControlPoints();
766 };
767
769 {
770 vtkWarningMacro("vtkMRMLMarkupsNode::GetNumberOfPointsInNthMarkup method is deprecated, please use GetNumberOfControlPoints instead");
771 return this->GetNumberOfControlPoints();
772 };
773
775 vtkVector3d GetMarkupPointVector(int markupIndex, int)
776 {
777 vtkWarningMacro("vtkMRMLMarkupsNode::GetMarkupPointVector method is deprecated, please use GetNthControlPointPositionVector instead");
778 return this->GetNthControlPointPositionVector(markupIndex);
779 };
780
782 void GetMarkupPoint(int markupIndex, int pointIndex, double point[3]);
783
785 void RemoveMarkup(int pointIndex)
786 {
787 vtkWarningMacro("vtkMRMLMarkupsNode::RemoveMarkup method is deprecated, please use RemoveNthControlPoint instead");
788 this->RemoveNthControlPoint(pointIndex);
789 };
790
794 void SetNthControlPointPositionFromPointer(const int pointIndex, const double* pos);
795
798 void SetNthControlPointPositionFromArray(const int pointIndex, const double pos[3], int positionStatus = PositionDefined)
799 {
800 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthControlPointPositionFromArray method is deprecated, please use SetNthControlPointPosition instead");
801 this->SetNthControlPointPosition(pointIndex, pos[0], pos[1], pos[2], positionStatus);
802 }
803
807 void SetNthControlPointPositionWorldFromArray(const int pointIndex, const double pos[3], int positionStatus = PositionDefined);
808
814 const double positionWorld[3], const double orientationMatrix_World[9],
815 const char* associatedNodeID, int positionStatus = PositionDefined)
816 {
817 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthControlPointPositionOrientationWorldFromArray method is deprecated,"
818 << " please use SetNthControlPointPositionOrientationWorld instead");
820 pointIndex, positionWorld, orientationMatrix_World, associatedNodeID, positionStatus);
821 }
822
828 vtkVector4d GetNthControlPointOrientationVector(int pointIndex);
829
834 {
835 vtkWarningMacro("vtkMRMLMarkupsNode::GetCenterOfRotationVector method is deprecated, please use GetCenterOfRotation instead");
836 return this->GetCenterOfRotation();
837 }
838
842 void SetCenterOfRotationFromPointer(const double* pos);
846 void SetCenterOfRotationFromArray(const double pos[3])
847 {
848 vtkWarningMacro("vtkMRMLMarkupsNode::SetCenterOfRotationFromArray method is deprecated, please use SetCenterOfRotation instead");
849 this->SetCenterOfRotation(pos[0], pos[1], pos[2]);
850 }
851
856 void SetNthControlPointOrientationFromPointer(int n, const double* orientationWXYZ);
857 void SetNthControlPointOrientationFromArray(int n, const double orientationWXYZ[4])
858 {
859 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthControlPointOrientationFromArray method is deprecated, please use SetNthControlPointOrientation instead");
860 this->SetNthControlPointOrientation(n, orientationWXYZ[0], orientationWXYZ[1], orientationWXYZ[2], orientationWXYZ[3]);
861 }
862
863
865 std::string GetNthMarkupAssociatedNodeID(int n = 0)
866 {
867 vtkWarningMacro("vtkMRMLMarkupsNode::GetNthMarkupAssociatedNodeID method is deprecated, please use GetNthControlPointAssociatedNodeID instead");
869 };
870
871 void SetNthMarkupAssociatedNodeID(int n, std::string id)
872 {
873 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthMarkupAssociatedNodeID method is deprecated, please use SetNthControlPointAssociatedNodeID instead");
875 };
876
878 std::string GetNthMarkupID(int n = 0)
879 {
880 vtkWarningMacro("vtkMRMLMarkupsNode::GetNthMarkupID method is deprecated, please use GetNthControlPointID instead");
881 return this->GetNthControlPointID(n);
882 };
883
885 bool GetNthMarkupLocked(int n = 0)
886 {
887 vtkWarningMacro("vtkMRMLMarkupsNode::GetNthMarkupLocked method is deprecated, please use GetNthControlPointLocked instead");
888 return this->GetNthControlPointLocked(n);
889 };
890
891 void SetNthMarkupLocked(int n, bool flag)
892 {
893 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthMarkupLocked method is deprecated, please use SetNthControlPointLocked instead");
894 this->SetNthControlPointLocked(n, flag);
895 };
896
898 std::string GetNthMarkupLabel(int n = 0)
899 {
900 vtkWarningMacro("vtkMRMLMarkupsNode::GetNthMarkupLabel method is deprecated, please use GetNthControlPointLabel instead");
901 return this->GetNthControlPointLabel(n);
902 };
903
904 void SetNthMarkupLabel(int n, std::string label)
905 {
906 vtkWarningMacro("vtkMRMLMarkupsNode::SetNthMarkupLabel method is deprecated, please use SetNthControlPointLabel instead");
907 this->SetNthControlPointLabel(n, label);
908 };
909
911 {
912 vtkWarningMacro("vtkMRMLMarkupsNode::GetMarkupLabelFormat method is deprecated, please use GetControlPointLabelFormat instead");
913 return this->GetControlPointLabelFormat();
914 };
915
916 void SetMarkupLabelFormat(std::string format)
917 {
918 // Not warning this at the moment as existing scene files will contain the markupLabelFormat attribute name and would warn on load
919 // vtkWarningMacro("vtkMRMLMarkupsNode::SetMarkupLabelFormat method is deprecated, please use SetControlPointLabelFormat instead");
920 return this->SetControlPointLabelFormat(format);
921 };
922
924 {
925 vtkWarningMacro("vtkMRMLMarkupsNode::ReplaceListNameInMarkupLabelFormat method is deprecated, please use ReplaceListNameInControlPointLabelFormat instead");
927 };
928
929protected:
934
935 vtkSmartPointer<vtkStringArray> TextList;
936
942 bool SetControlPointLabelsWorld(vtkStringArray* labels, vtkPoints* points, std::string separator = "");
943
947 ControlPoint* GetNthControlPointCustomLog(int n, const char* failedMethodName);
948
952 void SetNthControlPointID(int n, std::string id);
953
958
959 std::string GenerateControlPointLabel(int controlPointIndex);
960
962
964
968
972
975
978 const double position_Node[3], const double orientationMatrix_Node[9], double orientationMatrix_World[9]);
979
982 const double position_World[3], const double orientationMatrix_World[9], double orientationMatrix_Node[9]);
983
990
991 bool CurveClosed{false};
992
995
997 vtkSmartPointer<vtkCurveGenerator> CurveGenerator;
998
1003 vtkSmartPointer<vtkParallelTransportFrame> CurveCoordinateSystemGeneratorWorld;
1004
1007 vtkSmartPointer<vtkPolyData> CurveInputPoly;
1008
1009 vtkSmartPointer<vtkTransformPolyDataFilter> CurvePolyToWorldTransformer;
1010 vtkSmartPointer<vtkGeneralTransform> CurvePolyToWorldTransform;
1011
1014 vtkSmartPointer<vtkPointLocator> TransformedCurvePolyLocator;
1015
1017 int Locked{0};
1018
1022
1023 std::string ControlPointLabelFormat{"%N-%d"};
1024
1029
1032
1035 vtkVector3d CenterOfRotation;
1036
1038 vtkCollection* Measurements;
1039
1041
1043 std::string TypeDisplayName;
1044
1047
1049 vtkSmartPointer<vtkMatrix4x4> InteractionHandleToWorldMatrix;
1050
1052 bool IsUpdatingPoints{false};
1053
1054 friend class qSlicerMarkupsModuleWidget; // To directly access measurements
1055};
1056
1057#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
VTK_PROPEXCLUDE void SetNthControlPointPositionMissing(int pointIndex)
Set control point status to ignored.
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 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.
#define VTK_PROPEXCLUDE