21 #ifndef __vtkMRMLMarkupsROINode_h 22 #define __vtkMRMLMarkupsROINode_h 29 #include "vtkSlicerMarkupsModuleMRMLExport.h" 34 #include <vtkImplicitFunction.h> 35 #include <vtkMatrix4x4.h> 36 #include <vtkSmartPointer.h> 37 #include <vtkStringArray.h> 38 #include <vtkTransform.h> 62 void PrintSelf(ostream& os, vtkIndent indent)
override;
64 const char*
GetIcon()
override {
return ":/Icons/MarkupsROI.png";}
65 const char*
GetAddIcon()
override {
return ":/Icons/MarkupsROIMouseModePlace.png";}
66 const char*
GetPlaceAddIcon()
override {
return ":/Icons/MarkupsROIMouseModePlaceAdd.png";}
94 vtkGetVector3Macro(Size,
double);
96 void SetSize(
const double size[3]);
97 void SetSize(
double x,
double y,
double z);
98 void GetSizeWorld(
double size_World[3]);
99 void SetSizeWorld(
const double size_World[3]);
100 void SetSizeWorld(
double x_World,
double y_World,
double z_World);
104 void GetCenter(
double center[3]);
106 void GetCenterWorld(
double center[3]);
107 vtkVector3d GetCenter();
108 vtkVector3d GetCenterWorld();
109 void SetCenterWorld(
const double center[3]);
110 void SetCenterWorld(
double x,
double y,
double z);
111 void SetCenter(
const double center[3]);
112 void SetCenter(
double x,
double y,
double z);
116 void GetXAxisWorld(
double axis_World[3]);
119 void GetYAxisWorld(
double axis_World[3]);
120 void GetZAxisWorld(
double axis_World[3]);
121 void GetAxisWorld(
int axisIndex,
double axis_World[3]);
122 void GetXAxis(
double axis_Node[3]);
123 void GetYAxis(
double axis_Node[3]);
124 void GetZAxis(
double axis_Node[3]);
125 void GetAxis(
int axisIndex,
double axis_Node[3]);
129 vtkMatrix4x4* GetObjectToNodeMatrix()
132 return this->ObjectToNodeMatrix;
134 void SetAndObserveObjectToNodeMatrix(vtkMatrix4x4* objectToNodeMatrix);
141 return this->ObjectToWorldMatrix;
145 vtkGetMacro(ROIType,
int);
148 void SetROIType(
int roiType);
149 static const char* GetROITypeAsString(
int roiType);
150 static int GetROITypeFromString(
const char* roiType);
154 virtual void UpdateROIFromControlPoints();
156 virtual void UpdateBoxROIFromControlPoints();
157 virtual void UpdateBoundingBoxROIFromControlPoints();
161 virtual void UpdateControlPointsFromROI();
163 virtual void UpdateControlPointsFromBoundingBoxROI();
164 virtual void UpdateControlPointsFromBoxROI();
178 void ProcessMRMLEvents(vtkObject* caller,
unsigned long event,
void* callData)
override;
197 void GetBounds(
double bounds[6])
override;
201 void GetPlanes(vtkPlanes* planes) { this->GetPlanes(planes, this->GetInsideOut()); }
210 void GetPlanes(vtkPlanes* planes,
bool insideOut);
215 void GetPlanesWorld(vtkPlanes* planes,
bool insideOut);
219 bool IsPointInROI(
double point_Node[3]);
221 bool IsPointInROIWorld(
double point_World[3]);
225 void SetInsideOut(
bool insideOut);
230 vtkGetMacro(InsideOut,
bool);
231 vtkBooleanMacro(InsideOut,
bool);
235 vtkGetObjectMacro(ImplicitFunction, vtkImplicitFunction);
237 vtkGetObjectMacro(ImplicitFunctionWorld, vtkImplicitFunction);
244 int SetXYZ(
double center[3]);
254 int SetXYZ(
double x,
double y,
double z);
255 bool GetXYZ(
double center[3]);
259 void SetRadiusXYZ(
double radiusXYZ[3]);
267 void SetRadiusXYZ(
double x,
double y,
double z);
268 void GetRadiusXYZ(
double radiusXYZ[3]);
273 void GetTransformedPlanes(vtkPlanes* planes,
bool insideOut=
false);
276 static void GenerateOrthogonalMatrix(vtkMatrix4x4* inputMatrix,
279 vtkMatrix4x4* outputMatrix, vtkAbstractTransform* transform =
nullptr,
bool applyScaling =
true);
280 static void GenerateOrthogonalMatrix(
double xAxis[3],
double yAxis[3],
double zAxis[3],
double origin[3],
281 vtkMatrix4x4* outputMatrix, vtkAbstractTransform* transform =
nullptr,
bool applyScaling =
true);
288 void WriteCLI(std::vector<std::string>& commandLine,
290 int multipleFlag = 1)
override;
295 double Size[3]{ 0.0, 0.0, 0.0 };
297 bool IsUpdatingControlPointsFromROI{
false};
298 bool IsUpdatingROIFromControlPoints{
false};
299 bool IsUpdatingInteractionHandleToWorldMatrix{
false};
300 bool InsideOut{
false};
301 bool GetObjectToNodeMatrixRotated();
303 vtkSmartPointer<vtkMatrix4x4> ObjectToNodeMatrix {
nullptr };
304 vtkSmartPointer<vtkMatrix4x4> ObjectToWorldMatrix {
nullptr };
306 vtkSmartPointer<vtkImplicitFunction> ImplicitFunction {
nullptr };
307 vtkSmartPointer<vtkImplicitFunction> ImplicitFunctionWorld {
nullptr };
310 void GenerateBoxBounds(
double bounds[6],
double xAxis[3],
double yAxis[3],
double zAxis[3],
double center[3],
double size[3]);
313 void UpdateObjectToWorldMatrix();
316 void UpdateImplicitFunction();
void ApplyTransform(vtkAbstractTransform *transform) override
MRML node to represent an ROI markup.
vtkMatrix4x4 * GetObjectToWorldMatrix()
const char * GetTypeDisplayName() override
Requires two Control points that are removed after they have been placed.
void operator=(const vtkMRMLMarkupsNode &)
void CreateDefaultDisplayNodes() override
Create and observe default display node(s)
void GetBounds(double bounds[6]) override
void GetRASBounds(double bounds[6]) override
void OnTransformNodeReferenceChanged(vtkMRMLTransformNode *transformNode) override
Called when transform node reference added/modified/removed.
virtual void UpdateInteractionHandleToWorldMatrix()
Calculates the handle to world matrix based on the current control points.
void WriteCLI(std::vector< std::string > &commandLine, std::string prefix, int coordinateSystem=vtkMRMLStorageNode::CoordinateSystemRAS, int multipleFlag=1) override
const char * GetPlaceAddIcon() override
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
vtkMRMLCopyContentMacro(vtkMRMLMarkupsNode)
const char * GetIcon() override
const char * GetMarkupType() override
Get markup type internal name.
vtkMRMLStorageNode * CreateDefaultStorageNode() override
Create default storage node or nullptr if does not have one.
const char * GetAddIcon() override
A superclass for other storage nodes.
vtkMRMLNode * CreateNodeInstance() override=0
MRMLNode methods.
const char * GetDefaultNodeNamePrefix() override
Get markup short name.
ROI forms a bounding box around the control points.
void GetPlanesWorld(vtkPlanes *planes)
Abstract Superclass for all specific types of MRML nodes.
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
Alternative method to propagate events generated in Display nodes.
void PrintSelf(ostream &os, vtkIndent indent) override