18 #ifndef __vtkMRMLMarkupsCurveNode_h 19 #define __vtkMRMLMarkupsCurveNode_h 26 #include "vtkSlicerMarkupsModuleMRMLExport.h" 31 #include <vtkStringArray.h> 36 class vtkArrayCalculator;
37 class vtkAssignAttribute;
38 class vtkCallbackCommand;
39 class vtkCleanPolyData;
41 class vtkPassThroughFilter;
43 class vtkTransformPolyDataFilter;
44 class vtkTriangleFilter;
94 void PrintSelf(ostream& os, vtkIndent indent)
override;
96 const char*
GetIcon()
override {
return ":/Icons/MarkupsCurveMouseModePlace.png";}
110 void WriteXML(ostream& of,
int indent)
override;
124 double GetCurveLengthWorld(vtkIdType startCurvePointIndex=0, vtkIdType numberOfCurvePoints=-1);
128 static double GetCurveLength(vtkPoints* curvePoints,
bool closedCurve, vtkIdType startCurvePointIndex=0, vtkIdType numberOfCurvePoints=-1);
135 double GetCurveLengthBetweenStartEndPointsWorld(vtkIdType startCurvePointIndex, vtkIdType endCurvePointIndex);
138 bool SetControlPointLabels(vtkStringArray* labels, vtkPoints* points);
145 bool ResampleCurveSurface(
double controlPointDistance,
vtkMRMLModelNode* node,
double maximumSearchRadius=.25);
152 static bool ConstrainPointsToSurface(vtkPoints* originalPoints, vtkPoints* normalVectors, vtkPolyData* surfacePolydata,
153 vtkPoints* surfacePoints,
double maximumSearchRadius=.25);
155 void ResampleCurveWorld(
double controlPointDistance);
157 static bool ResamplePoints(vtkPoints* originalPoints, vtkPoints* interpolatedPoints,
double samplingDistance,
bool closedCurve);
161 bool GetSampledCurvePointsBetweenStartEndPointsWorld(vtkPoints* sampledPoints,
162 double samplingDistance, vtkIdType startCurvePointIndex, vtkIdType endCurvePointIndex);
165 vtkIdType GetClosestCurvePointIndexToPositionWorld(
const double posWorld[3]);
172 vtkIdType GetClosestPointPositionAlongCurveWorld(
const double posWorld[3],
double closestPosWorld[3]);
178 vtkIdType GetFarthestCurvePointIndexToPositionWorld(
const double posWorld[3]);
182 vtkIdType GetCurvePointIndexFromControlPointIndex(
int controlPointIndex);
185 static bool GetPositionAndClosestPointIndexAlongCurve(
double foundCurvePosition[3], vtkIdType& foundClosestPointIndex,
186 vtkIdType startCurvePointId,
double distanceFromStartPoint, vtkPoints* curvePoints,
bool closedCurve);
192 vtkIdType GetCurvePointIndexAlongCurveWorld(vtkIdType startCurvePointId,
double distanceFromStartPoint);
199 bool GetPositionAlongCurveWorld(
double foundCurvePosition[3], vtkIdType startCurvePointId,
double distanceFromStartPoint);
203 bool GetCurveDirectionAtPointIndexWorld(vtkIdType curvePointIndex,
double directionVectorWorld[3]);
212 bool GetCurvePointToWorldTransformAtPointIndex(vtkIdType curvePointIndex, vtkMatrix4x4* curvePointToWorld);
214 bool GetPointsOnPlaneWorld(vtkPlane* plane, vtkPoints* intersectionPoints);
218 void SetCurveType(
int type);
219 const char* GetCurveTypeAsString(
int id);
220 int GetCurveTypeFromString(
const char* name);
221 void SetCurveTypeToLinear();
222 void SetCurveTypeToCardinalSpline();
223 void SetCurveTypeToKochanekSpline();
224 void SetCurveTypeToPolynomial();
225 void SetCurveTypeToShortestDistanceOnSurface(
vtkMRMLModelNode* modelNode=
nullptr);
238 int GetSurfaceCostFunctionType();
239 void SetSurfaceCostFunctionType(
int surfaceCostFunctionType);
240 static const char* GetSurfaceCostFunctionTypeAsString(
int surfaceCostFunctionType);
241 static int GetSurfaceCostFunctionTypeFromString(
const char* name);
245 const char* GetSurfaceDistanceWeightingFunction();
246 void SetSurfaceDistanceWeightingFunction(
const char*
function);
249 int GetNumberOfPointsPerInterpolatingSegment();
252 void SetNumberOfPointsPerInterpolatingSegment(
int pointsPerSegment);
276 void ProcessMRMLEvents(vtkObject* caller,
unsigned long event,
void* callData)
override;
281 virtual void UpdateSurfaceScalarVariables();
282 virtual void OnSurfaceModelNodeChanged();
283 virtual void OnSurfaceModelTransformChanged();
293 static void OnCurvatureMeasurementModified(vtkObject* caller,
unsigned long eid,
void* clientData,
void* callData);
static vtkMRMLMarkupsNode * New()
MRML node to represent a curve markup Curve Markups nodes contain N control points. Visualization parameters are set in the vtkMRMLMarkupsDisplayNode class.
void OnNodeReferenceRemoved(vtkMRMLNodeReference *reference) override
Called after a node reference ID is removed (list size decreased).
vtkSmartPointer< vtkPassThroughFilter > SurfaceScalarPassThroughFilter
MRML node to represent a 3D surface model.
void operator=(const vtkMRMLMarkupsNode &)
const char * GetShortestDistanceSurfaceNodeReferenceMRMLAttributeName()
vtkSmartPointer< vtkArrayCalculator > SurfaceScalarCalculator
Filter that generates curves between points of an input polydata.
vtkSmartPointer< vtkCleanPolyData > CleanFilter
void OnNodeReferenceAdded(vtkMRMLNodeReference *reference) override
Called when a node reference ID is added (list size increased).
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
vtkSmartPointer< vtkTriangleFilter > TriangleFilter
vtkSmartPointer< vtkAssignAttribute > ScalarDisplayAssignAttribute
const char * GetIcon() override
virtual void UpdateMeasurementsInternal()
vtkMRMLCopyContentMacro(vtkMRMLMarkupsNode)
vtkSmartPointer< vtkTransformPolyDataFilter > SurfaceToLocalTransformer
vtkPoints * GetCurvePointsWorld()
vtkMRMLNode * CreateNodeInstance() override
MRMLNode methods.
const char * ShortestDistanceSurfaceActiveScalar
vtkCallbackCommand * CurvatureMeasurementModifiedCallbackCommand
Command handling curvature measurement modified events to propagate enabled state.
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file.
const char * GetShortestDistanceSurfaceNodeReferenceRole()
Node reference role for the surface that is used in the shortest surface distance curve type...
Abstract Superclass for all specific types of MRML nodes.
Class to hold information about a node reference.
void OnNodeReferenceModified(vtkMRMLNodeReference *reference) override
Called when a node reference ID is modified.
virtual void UpdateAssignedAttribute()
vtkSmartPointer< vtkCurveMeasurementsCalculator > CurveMeasurementsCalculator
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
Alternative method to propagate events generated in Display nodes.
void PrintSelf(ostream &os, vtkIndent indent) override