21#ifndef __vtkMRMLMarkupsROINode_h
22#define __vtkMRMLMarkupsROINode_h
29#include "vtkMRMLExport.h"
34#include <vtkImplicitBoolean.h>
35#include <vtkImplicitFunction.h>
36#include <vtkMatrix4x4.h>
37#include <vtkSmartPointer.h>
38#include <vtkStringArray.h>
39#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";}
85 using Superclass::ApplyTransform;
86 void ApplyTransform(vtkAbstractTransform* transform,
bool applyToLockedControlPoints)
override;
90 vtkGetVector3Macro(Size,
double);
92 void SetSize(
double x,
double y,
double z);
120 void GetAxis(
int axisIndex,
double axis_Node[3]);
127 return this->ObjectToNodeMatrix;
136 return this->ObjectToWorldMatrix;
142 vtkGetMacro(ROIType,
int);
229 vtkGetMacro(InsideOut,
bool);
230 vtkBooleanMacro(InsideOut,
bool);
234 vtkGetObjectMacro(ImplicitFunction, vtkImplicitFunction);
257 int SetXYZ(
double x,
double y,
double z);
282 vtkMatrix4x4* outputMatrix, vtkAbstractTransform* transform =
nullptr,
bool applyScaling =
true);
284 vtkMatrix4x4* outputMatrix, vtkAbstractTransform* transform =
nullptr,
bool applyScaling =
true);
291 void WriteCLI(std::vector<std::string>& commandLine,
293 int multipleFlag = 1)
override;
298 double Size[3]{ 0.0, 0.0, 0.0 };
300 bool IsUpdatingControlPointsFromROI{
false};
301 bool IsUpdatingROIFromControlPoints{
false};
302 bool IsUpdatingInteractionHandleToWorldMatrix{
false};
303 bool InsideOut{
false};
306 vtkSmartPointer<vtkMatrix4x4> ObjectToNodeMatrix {
nullptr };
307 vtkSmartPointer<vtkMatrix4x4> ObjectToWorldMatrix {
nullptr };
309 vtkSmartPointer<vtkImplicitFunction> ImplicitFunction {
nullptr };
310 vtkSmartPointer<vtkImplicitFunction> ImplicitFunctionWorld {
nullptr };
313 void GenerateBoxBounds(
double bounds[6],
double xAxis[3],
double yAxis[3],
double zAxis[3],
double center[3],
double size[3]);
MRML node to represent an ROI markup.
void GetXAxisWorld(double axis_World[3])
int SetXYZ(double center[3])
void GetRASBounds(double bounds[6]) override
void SetSize(const double size[3])
int SetXYZ(double x, double y, double z)
void GetObjectBounds(double bounds[6])
void SetCenter(double x, double y, double z)
void UpdateObjectToWorldMatrix()
Calculates the transform from the Object (ROI) to World coordinates.
void GetBounds(double bounds[6]) override
void PrintSelf(ostream &os, vtkIndent indent) override
Print out the node information to the output stream.
void GetPlanesWorld(vtkPlanes *planes, bool insideOut)
void WriteCLI(std::vector< std::string > &commandLine, std::string prefix, int coordinateSystem=vtkMRMLStorageNode::CoordinateSystemRAS, int multipleFlag=1) override
bool IsPointInROI(double point_Node[3])
Returns true if the specified point is within the ROI.
vtkVector3d GetCenterWorld()
void ApplyTransform(vtkAbstractTransform *transform, bool applyToLockedControlPoints) override
void OnTransformNodeReferenceChanged(vtkMRMLTransformNode *transformNode) override
Reimplemented to recalculate InteractionHandleToWorld matrix when parent transform is changed.
vtkMatrix4x4 * GetObjectToWorldMatrix()
void GetAxisWorld(int axisIndex, double axis_World[3])
const char * GetIcon() override
void SetSizeWorld(const double size_World[3])
vtkMRMLNode * CreateNodeInstance() override
MRMLNode methods.
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
const char * GetAddIcon() override
void GetCenter(double center[3])
Center of the ROI.
static int GetROITypeFromString(const char *roiType)
virtual void UpdateROIFromControlPoints()
Calculate the ROI dimensions from the control points.
void SetRadiusXYZ(double x, double y, double z)
vtkImplicitFunction * GetImplicitFunctionWorld() override
Get the implicit function that represents the ROI in world coordinates.
void GetAxis(int axisIndex, double axis_Node[3])
static void GenerateOrthogonalMatrix(vtkMatrix4x4 *inputMatrix, vtkMatrix4x4 *outputMatrix, vtkAbstractTransform *transform=nullptr, bool applyScaling=true)
bool GetObjectToNodeMatrixRotated()
void SetRadiusXYZ(double radiusXYZ[3])
void GetZAxisWorld(double axis_World[3])
static const char * GetROITypeAsString(int roiType)
void SetROIType(int roiType)
void GetTransformedPlanes(vtkPlanes *planes, bool insideOut=false)
void GetYAxisWorld(double axis_World[3])
~vtkMRMLMarkupsROINode() override
virtual void UpdateBoundingBoxROIFromControlPoints()
void GetPlanesWorld(vtkPlanes *planes)
void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData) override
Alternative method to propagate events generated in Display nodes.
VTK_NEWINSTANCE vtkPolyData * CreateROIBoxPolyDataWorld()
void SetCenterWorld(double x, double y, double z)
@ ROITypeBoundingBox
ROI forms a bounding box around the control points.
@ ROITypeBox
Requires two Control points that are removed after they have been placed.
void SetCenterWorld(const double center[3])
static vtkMRMLMarkupsROINode * New()
virtual void UpdateControlPointsFromBoundingBoxROI()
void GetSizeWorld(double size_World[3])
void operator=(const vtkMRMLMarkupsROINode &)
vtkMatrix4x4 * GetObjectToNodeMatrix()
4x4 matrix defining the object center and axis directions within the node coordinate system.
void GetCenterWorld(double center[3])
const char * GetMarkupType() override
Get markup type internal name.
virtual void UpdateBoxROIFromControlPoints()
vtkMRMLStorageNode * CreateDefaultStorageNode() override
Create default storage node or nullptr if does not have one.
virtual void UpdateControlPointsFromBoxROI()
const char * GetPlaceAddIcon() override
bool IsPointInROIWorld(double point_World[3])
vtkMRMLCopyContentMacro(vtkMRMLMarkupsROINode)
void SetSizeWorld(double x_World, double y_World, double z_World)
void GetYAxis(double axis_Node[3])
bool GetXYZ(double center[3])
void GenerateBoxBounds(double bounds[6], double xAxis[3], double yAxis[3], double zAxis[3], double center[3], double size[3])
Fills the specified vtkPoints with the points for all of the box ROI corners.
void SetAndObserveObjectToNodeMatrix(vtkMatrix4x4 *objectToNodeMatrix)
void CreateDefaultDisplayNodes() override
Create default display node or nullptr if does not have one.
virtual void UpdateControlPointsFromROI()
Calculate the position of control points from the ROI.
void GetRadiusXYZ(double radiusXYZ[3])
static void GenerateOrthogonalMatrix(double xAxis[3], double yAxis[3], double zAxis[3], double origin[3], vtkMatrix4x4 *outputMatrix, vtkAbstractTransform *transform=nullptr, bool applyScaling=true)
void SetCenter(const double center[3])
void UpdateImplicitFunction()
Updates the parameters of the internal implicit functions.
void GetXAxis(double axis_Node[3])
void SetSize(double x, double y, double z)
void GetPlanes(vtkPlanes *planes, bool insideOut)
void GetPlanes(vtkPlanes *planes)
void GetZAxis(double axis_Node[3])
void UpdateInteractionHandleToWorldMatrix() override
Update the InteractionHandleToWorldMatrix based on the ObjectToNode and NodeToWorld transforms.
vtkMRMLMarkupsROINode(const vtkMRMLMarkupsROINode &)
void SetInsideOut(bool insideOut)
Abstract Superclass for all specific types of MRML nodes.
A superclass for other storage nodes.