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;
44 class vtkTransformPolyDataFilter;
45 class vtkTriangleFilter;
95 void PrintSelf(ostream& os, vtkIndent indent)
override;
97 const char*
GetIcon()
override {
return ":/Icons/MarkupsOpenCurve.png";}
98 const char*
GetAddIcon()
override {
return ":/Icons/MarkupsCurveMouseModePlace.png";}
99 const char*
GetPlaceAddIcon()
override {
return ":/Icons/MarkupsCurveMouseModePlaceAdd.png";}
122 void WriteXML(ostream& of,
int indent)
override;
140 double GetCurveLengthWorld(vtkIdType startCurvePointIndex=0, vtkIdType numberOfCurvePoints=-1);
144 static double GetCurveLength(vtkPoints* curvePoints,
bool closedCurve, vtkIdType startCurvePointIndex=0, vtkIdType numberOfCurvePoints=-1);
151 double GetCurveLengthBetweenStartEndPointsWorld(vtkIdType startCurvePointIndex, vtkIdType endCurvePointIndex);
154 bool SetControlPointLabels(vtkStringArray* labels, vtkPoints* points);
163 static bool ConstrainPointsToSurface(vtkPoints* originalPoints, vtkPoints* normalVectors, vtkPolyData* surfacePolydata,
164 vtkPoints* surfacePoints,
double maximumSearchRadius=.25);
167 void ResampleCurveWorld(
double controlPointDistance);
173 static bool ResamplePoints(vtkPoints* originalPoints, vtkPoints* interpolatedPoints,
174 double samplingDistance,
bool closedCurve, vtkDoubleArray* pedigreeIdsArray=
nullptr);
177 static bool ResampleStaticControlPointMeasurements(vtkCollection* measurements, vtkDoubleArray* curvePointsPedigreeIdsArray,
int curvePointsPerControlPoint);
181 bool GetSampledCurvePointsBetweenStartEndPointsWorld(vtkPoints* sampledPoints,
182 double samplingDistance, vtkIdType startCurvePointIndex, vtkIdType endCurvePointIndex);
185 vtkIdType GetClosestCurvePointIndexToPositionWorld(
const double posWorld[3]);
192 vtkIdType GetClosestPointPositionAlongCurveWorld(
const double posWorld[3],
double closestPosWorld[3]);
198 vtkIdType GetFarthestCurvePointIndexToPositionWorld(
const double posWorld[3]);
202 vtkIdType GetCurvePointIndexFromControlPointIndex(
int controlPointIndex);
205 static bool GetPositionAndClosestPointIndexAlongCurve(
double foundCurvePosition[3], vtkIdType& foundClosestPointIndex,
206 vtkIdType startCurvePointId,
double distanceFromStartPoint, vtkPoints* curvePoints,
bool closedCurve);
212 vtkIdType GetCurvePointIndexAlongCurveWorld(vtkIdType startCurvePointId,
double distanceFromStartPoint);
219 bool GetPositionAlongCurveWorld(
double foundCurvePosition[3], vtkIdType startCurvePointId,
double distanceFromStartPoint);
223 bool GetCurveDirectionAtPointIndexWorld(vtkIdType curvePointIndex,
double directionVectorWorld[3]);
232 bool GetCurvePointToWorldTransformAtPointIndex(vtkIdType curvePointIndex, vtkMatrix4x4* curvePointToWorld);
234 bool GetPointsOnPlaneWorld(vtkPlane* plane, vtkPoints* intersectionPoints);
238 void SetCurveType(
int type);
239 const char* GetCurveTypeAsString(
int id);
240 int GetCurveTypeFromString(
const char* name);
241 void SetCurveTypeToLinear();
242 void SetCurveTypeToCardinalSpline();
243 void SetCurveTypeToKochanekSpline();
244 void SetCurveTypeToPolynomial();
245 void SetCurveTypeToShortestDistanceOnSurface(
vtkMRMLModelNode* modelNode=
nullptr);
278 void SetSurfaceConstraintMaximumSearchRadiusTolerance(
double tolerance);
279 double GetSurfaceConstraintMaximumSearchRadiusTolerance()
const;
284 int GetSurfaceCostFunctionType();
285 void SetSurfaceCostFunctionType(
int surfaceCostFunctionType);
286 static const char* GetSurfaceCostFunctionTypeAsString(
int surfaceCostFunctionType);
287 static int GetSurfaceCostFunctionTypeFromString(
const char* name);
291 const char* GetSurfaceDistanceWeightingFunction();
292 void SetSurfaceDistanceWeightingFunction(
const char*
function);
295 int GetNumberOfPointsPerInterpolatingSegment();
298 void SetNumberOfPointsPerInterpolatingSegment(
int pointsPerSegment);
323 void ProcessMRMLEvents(vtkObject* caller,
unsigned long event,
void* callData)
override;
328 virtual void UpdateSurfaceScalarVariables();
329 virtual void OnSurfaceModelNodeChanged();
330 virtual void OnSurfaceModelTransformChanged();
340 static void OnCurvatureMeasurementModified(vtkObject* caller,
unsigned long eid,
void* clientData,
void* callData);
343 vtkSmartPointer<vtkProjectMarkupsCurvePointsFilter> ProjectPointsFilter;
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).
Projects curve points from a vtkMRMLMarkupsCurveNode to the surface of a model.
const char * GetMarkupType() override
Get markup type internal name.
MRML node to represent a 3D surface model.
virtual vtkPoints * GetCurvePointsWorld()
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 * GetPlaceAddIcon() override
virtual vtkAlgorithmOutput * GetCurveWorldConnection()
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
virtual vtkPolyData * GetCurveWorld()
const char * GetDefaultNodeNamePrefix() override
Get markup short name.
vtkSmartPointer< vtkTriangleFilter > TriangleFilter
vtkSmartPointer< vtkAssignAttribute > ScalarDisplayAssignAttribute
const char * GetIcon() override
virtual void UpdateMeasurementsInternal()
const char * GetTypeDisplayName() override
void SetAndObserveShortestDistanceSurfaceNode(vtkMRMLModelNode *modelNode)
vtkMRMLCopyContentMacro(vtkMRMLMarkupsNode)
vtkMRMLModelNode * GetShortestDistanceSurfaceNode()
vtkSmartPointer< vtkTransformPolyDataFilter > SurfaceToLocalTransformer
vtkSmartPointer< vtkPassThrough > SurfaceScalarPassThroughFilter
const char * GetSurfaceConstraintNodeReferenceMRMLAttributeName()
vtkMRMLNode * CreateNodeInstance() override=0
MRMLNode methods.
const char * ShortestDistanceSurfaceActiveScalar
vtkCallbackCommand * CurvatureMeasurementModifiedCallbackCommand
Command handling curvature measurement modified events to propagate enabled state.
vtkSmartPointer< vtkPassThrough > WorldOutput
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file.
const char * GetSurfaceConstraintNodeReferenceRole()
Node reference role for the surface that is used to project the curve onto.
const char * GetShortestDistanceSurfaceNodeReferenceRole()
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()
const char * GetAddIcon() override
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