18 #ifndef __vtkMRMLMarkupsNode_h 19 #define __vtkMRMLMarkupsNode_h 27 #include "vtkSlicerMarkupsModuleMRMLExport.h" 30 #include <vtkPointLocator.h> 31 #include <vtkSmartPointer.h> 32 #include <vtkVector.h> 34 class vtkFrenetSerretFrame;
61 class vtkAlgorithmOutput;
64 class vtkGeneralTransform;
69 class vtkTransformPolyDataFilter;
85 this->Position[0] = 0.0;
86 this->Position[1] = 0.0;
87 this->Position[2] = 0.0;
89 this->OrientationMatrix[0] = 1.0;
90 this->OrientationMatrix[1] = 0.0;
91 this->OrientationMatrix[2] = 0.0;
93 this->OrientationMatrix[3] = 0.0;
94 this->OrientationMatrix[4] = 1.0;
95 this->OrientationMatrix[5] = 0.0;
97 this->OrientationMatrix[6] = 0.0;
98 this->OrientationMatrix[7] = 0.0;
99 this->OrientationMatrix[8] = 1.0;
104 PositionStatus = PositionUndefined;
113 double OrientationMatrix[9];
131 void PrintSelf(ostream& os, vtkIndent indent)
override;
147 void WriteXML(ostream& of,
int indent)
override;
153 void WriteCLI(std::vector<std::string>& commandLine,
154 std::string prefix,
int coordinateSystem = 0,
155 int multipleFlag = 1)
override;
178 int GetNumberOfMeasurements();
179 int GetNumberOfEnabledMeasurements();
183 void RemoveNthMeasurement(
int id);
184 void ClearValueForAllMeasurements();
189 void UpdateAllMeasurements();
202 void SetNthMeasurement(
int id,
const std::string& name,
double value,
const std::string &units,
203 std::string printFormat =
"",
const std::string description =
"",
206 void RemoveAllMeasurements();
226 LockModifiedEvent = 19000,
250 static const char* GetPositionStatusAsString(
int id);
251 static int GetPositionStatusFromString(
const char* name);
254 virtual void RemoveAllControlPoints();
260 vtkGetMacro(Locked,
int);
268 void SetLocked(
int locked);
271 vtkBooleanMacro(Locked,
int);
277 bool ControlPointExists(
int n);
282 int GetNumberOfControlPoints();
284 int GetNumberOfDefinedControlPoints(
bool includePreview=
false);
290 ControlPoint* GetNthControlPoint(
int n);
292 std::vector<ControlPoint*>* GetControlPoints();
299 int AddNControlPoints(
int n, std::string label = std::string(), vtkVector3d* point =
nullptr);
302 int AddControlPointWorld(vtkVector3d point, std::string label = std::string());
304 int AddControlPoint(vtkVector3d point, std::string label = std::string());
310 int AddControlPoint(ControlPoint *controlPoint,
bool autoLabel=
true);
314 vtkVector3d GetNthControlPointPositionVector(
int pointIndex);
317 vtkVector3d
GetMarkupPointVector(
int markupIndex,
int) {
return this->GetNthControlPointPositionVector(markupIndex); };
320 void GetMarkupPoint(
int markupIndex,
int pointIndex,
double point[3]);
324 void GetNthControlPointPosition(
int pointIndex,
double point[3]);
325 double* GetNthControlPointPosition(
int pointIndex);
328 int GetNthControlPointPositionWorld(
int pointIndex,
double worldxyz[3]);
331 int GetNthControlPointPositionStatus(
int pointIndex);
337 int GetNthControlPointIndexByPositionStatus(
int pointIndex,
int positionStatus);
340 void UnsetNthControlPointPosition(
int pointIndex);
343 void RemoveNthControlPoint(
int pointIndex);
346 void RemoveMarkup(
int pointIndex) { this->RemoveNthControlPoint(pointIndex); };
354 bool InsertControlPoint(ControlPoint* controlPoint,
int targetIndex);
358 bool InsertControlPointWorld(
int n, vtkVector3d pointWorld, std::string label = std::string());
362 bool InsertControlPoint(
int n, vtkVector3d point, std::string label = std::string());
365 void SwapControlPoints(
int m1,
int m2);
369 void SetNthControlPointPositionFromPointer(
const int pointIndex,
const double *pos);
372 void SetNthControlPointPositionFromArray(
const int pointIndex,
const double pos[3],
int positionStatus = PositionDefined);
375 void SetNthControlPointPosition(
const int pointIndex,
const double x,
const double y,
const double z,
int positionStatus = PositionDefined);
379 void SetNthControlPointPositionWorld(
const int pointIndex,
const double x,
const double y,
const double z);
382 void SetNthControlPointPositionWorldFromArray(
const int pointIndex,
const double pos[3],
int positionStatus = PositionDefined);
385 void SetNthControlPointPositionOrientationWorldFromArray(
const int pointIndex,
386 const double pos[3],
const double orientationMatrix[9],
const char* associatedNodeID,
int positionStatus = PositionDefined);
390 vtkVector3d GetCenterPositionVector();
393 void GetCenterPosition(
double point[3]);
396 int GetCenterPositionWorld(
double worldxyz[3]);
399 void SetCenterPositionFromPointer(
const double *pos);
402 void SetCenterPositionFromArray(
const double pos[3]);
405 void SetCenterPosition(
const double x,
const double y,
const double z);
409 void SetCenterPositionWorld(
const double x,
const double y,
const double z);
412 void SetNthControlPointOrientationFromPointer(
int n,
const double *orientationWXYZ);
414 void SetNthControlPointOrientationFromArray(
int n,
const double orientationWXYZ[4]);
416 void SetNthControlPointOrientation(
int n,
double w,
double x,
double y,
double z);
418 void GetNthControlPointOrientation(
int n,
double orientationWXYZ[4]);
420 double* GetNthControlPointOrientationMatrix(
int n);
422 void SetNthControlPointOrientationMatrix(
int n,
double orientationMatrix[9]);
426 void SetNthControlPointOrientationMatrixWorld(
int n,
double orientationMatrix[9]);
428 double* GetNthControlPointNormal(
int n);
430 void GetNthControlPointNormalWorld(
int n,
double normalWorld[3]);
435 vtkVector4d GetNthControlPointOrientationVector(
int pointIndex);
438 std::string GetNthControlPointAssociatedNodeID(
int n = 0);
439 void SetNthControlPointAssociatedNodeID(
int n, std::string
id);
447 std::string GetNthControlPointID(
int n);
453 int GetNthControlPointIndexByID(
const char* controlPointID);
455 ControlPoint* GetNthControlPointByID(
const char* controlPointID);
459 bool GetNthControlPointSelected(
int n = 0);
462 void SetNthControlPointSelected(
int n,
bool flag);
466 bool GetNthControlPointLocked(
int n = 0);
473 void SetNthControlPointLocked(
int n,
bool flag);
482 bool GetNthControlPointVisibility(
int n = 0);
490 void SetNthControlPointVisibility(
int n,
bool flag);
494 std::string GetNthControlPointLabel(
int n = 0);
496 void SetNthControlPointLabel(
int n, std::string label);
505 std::string GetNthControlPointDescription(
int n = 0);
507 void SetNthControlPointDescription(
int n, std::string description);
518 std::string GetMarkupLabelFormat();
528 void SetMarkupLabelFormat(std::string format);
534 std::string ReplaceListNameInMarkupLabelFormat();
548 bool ResetNthControlPointID(
int n);
553 vtkGetMacro(RequiredNumberOfControlPoints,
int);
563 vtkGetMacro(MaximumNumberOfControlPoints,
int);
566 static void ConvertOrientationMatrixToWXYZ(
const double orientationMatrix[9],
double orientationWXYZ[4]);
567 static void ConvertOrientationWXYZToMatrix(
double orientationWXYZ[4],
double orientationMatrix[9]);
569 void GetControlPointLabels(vtkStringArray* labels);
571 vtkPoints* GetCurvePoints();
572 vtkPoints* GetCurvePointsWorld();
574 vtkPolyData* GetCurve();
575 vtkPolyData* GetCurveWorld();
577 vtkAlgorithmOutput* GetCurveWorldConnection();
579 vtkGetMacro(CurveClosed,
bool);
581 int GetControlPointIndexFromInterpolatedPointIndex(vtkIdType interpolatedPointIndex);
589 void GetBounds(
double bounds[6])
override;
592 int GetClosestControlPointIndexToPositionWorld(
double pos[3]);
599 void SetControlPointPositionsWorld(vtkPoints* points);
602 void GetControlPointPositionsWorld(vtkPoints* points);
605 virtual vtkMatrix4x4* GetInteractionHandleToWorldMatrix();
607 virtual std::string GetPropertiesLabelText();
629 bool SetControlPointLabelsWorld(vtkStringArray* labels, vtkPoints* points, std::string separator =
"");
634 ControlPoint* GetNthControlPointCustomLog(
int n,
const char* failedMethodName);
639 void SetNthControlPointID(
int n, std::string
id);
644 std::string GenerateUniqueControlPointID();
646 std::string GenerateControlPointLabel(
int controlPointIndex);
648 virtual void UpdateCurvePolyFromControlPoints();
654 virtual void UpdateMeasurementsInternal();
658 virtual void WriteMeasurementsToDescription();
661 virtual void UpdateInteractionHandleToWorldMatrix();
665 int RequiredNumberOfControlPoints{0};
668 int MaximumNumberOfControlPoints{0};
670 bool CurveClosed{
false};
698 std::string MarkupLabelFormat{
"%N-%d"};
703 int LastUsedControlPointNumber{0};
718 bool IsUpdatingPoints{
false};
void SetNthMarkupAssociatedNodeID(int n, std::string id)
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
alternative method to propagate events generated in Display nodes
ControlPointsListType ControlPoints
Vector of control points.
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file
Filter that generates curves between points of an input polydata.
virtual vtkMRMLStorageNode * CreateDefaultStorageNode()
virtual void GetBounds(double bounds[6])
int GetNumberOfPointsInNthMarkup(int)
bool MarkupExists(int n)
Deprecated. Use ControlPointExists instead.
std::vector< ControlPoint * > ControlPointsListType
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
bool GetNthMarkupLocked(int n=0)
vtkSmartPointer< vtkCurveGenerator > CurveGenerator
Converts curve control points to curve points.
virtual void WriteCLI(std::vector< std::string > &vtkNotUsed(commandLine), std::string vtkNotUsed(prefix), int vtkNotUsed(coordinateSystemFlag)=0, int vtkNotUsed(multipleFlag)=1)
virtual bool GetModifiedSinceRead()
Class for storing well-defined measurement results, using coded entries.
vtkSmartPointer< vtkStringArray > TextList
void SetNthMarkupLocked(int n, bool flag)
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
vtkSmartPointer< vtkPolyData > CurveInputPoly
vtkVector3d GetMarkupPointVector(int markupIndex, int)
std::string GetNthMarkupLabel(int n=0)
void operator=(const vtkMRMLDisplayableNode &)
std::string GetNthMarkupAssociatedNodeID(int n=0)
void SetNthMarkupLabel(int n, std::string label)
vtkSmartPointer< vtkTransformPolyDataFilter > CurvePolyToWorldTransformer
Simple class for storing standard coded entries (coding scheme, value, meaning triplets) ...
void PrintSelf(ostream &os, vtkIndent indent) override
virtual void CreateDefaultDisplayNodes()
virtual const char * GetIcon()
void RemoveMarkup(int pointIndex)
vtkSmartPointer< vtkFrenetSerretFrame > CurveCoordinateSystemGeneratorWorld
vtkSmartPointer< vtkGeneralTransform > CurvePolyToWorldTransform
A superclass for other storage nodes.
std::string PropertiesLabelText
vtkMRMLNode * CreateNodeInstance() override=0
MRMLNode methods.
vtkCollection * Measurements
List of measurements stored for the markup.
vtkMRMLCopyContentMacro(vtkMRMLStorableNode)
vtkCurveGenerator * GetCurveGenerator()
std::string GetNthMarkupID(int n=0)
Abstract Superclass for all specific types of MRML nodes.
vtkSmartPointer< vtkPointLocator > TransformedCurvePolyLocator
virtual void UpdateAssignedAttribute()
Node that holds the information about a unit.
std::string AssociatedNodeID
vtkSmartPointer< vtkMatrix4x4 > InteractionHandleToWorldMatrix
Transform that moves the xyz unit vectors and origin of the interaction handles to local coordinates...
virtual void GetRASBounds(double bounds[6])