Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLSliceNode.h
Go to the documentation of this file.
1/*=auto=========================================================================
2
3 Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
4
5 See COPYRIGHT.txt
6 or http://www.slicer.org/copyright/copyright.txt for details.
7
8 Program: 3D Slicer
9 Module: $RCSfile: vtkMRMLSliceNode.h,v $
10 Date: $Date: 2006/03/19 17:12:29 $
11 Version: $Revision: 1.3 $
12
13=========================================================================auto=*/
14
15#ifndef __vtkMRMLSliceNode_h
16#define __vtkMRMLSliceNode_h
17
18// MRML includes
21
22// VTK includes
23class vtkImplicitFunction;
24class vtkMatrix3x3;
25class vtkMatrix4x4;
26class vtkPlane;
27
34class VTK_MRML_EXPORT vtkMRMLSliceNode : public vtkMRMLAbstractViewNode
35{
36public:
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
48
51 void ReadXMLAttributes(const char** atts) override;
52
55 void WriteXML(ostream& of, int indent) override;
56
60
64 void Reset(vtkMRMLNode* defaultNode) override;
65
68 const char* GetNodeTagName() override { return "Slice"; };
69
76 virtual vtkMatrix4x4* GetSliceToRAS();
77
80 vtkGetMacro(SliceVisible, int);
81 vtkSetMacro(SliceVisible, int);
82
85 vtkGetMacro(SliceEdgeVisibility3D, bool);
86 vtkSetMacro(SliceEdgeVisibility3D, bool);
87 vtkBooleanMacro(SliceEdgeVisibility3D, bool);
88
91 vtkGetMacro(WidgetVisible, int);
92 vtkSetMacro(WidgetVisible, int);
93
96 vtkGetMacro(WidgetOutlineVisible, int);
97 vtkSetMacro(WidgetOutlineVisible, int);
98
101 void AddThreeDViewID(const char* viewNodeID);
104 void RemoveThreeDViewID(char* viewNodeID);
115 const char* GetNthThreeDViewID(unsigned int index);
119 inline std::vector<std::string> GetThreeDViewIDs() const;
123 bool IsThreeDViewIDPresent(const char* ThreeDViewID) const;
128 bool IsDisplayableInThreeDView(const char* viewNodeID) const;
129
132 vtkGetMacro(WidgetNormalLockedToCamera, int);
133 vtkSetMacro(WidgetNormalLockedToCamera, int);
134
137 vtkGetMacro(UseLabelOutline, int);
138 vtkSetMacro(UseLabelOutline, int);
139 vtkBooleanMacro(UseLabelOutline, int);
140
150
154
161 std::string GetOrientation();
162
164 std::string GetOrientation(vtkMatrix4x4* sliceToRAS);
165
176 bool SetOrientation(const char* orientation);
177
182 vtkSetStringMacro(DefaultOrientation);
183 vtkGetStringMacro(DefaultOrientation);
184
188 virtual const char* GetOrientationString();
189
190protected:
195 vtkGetStringMacro(OrientationReference);
196 vtkSetStringMacro(OrientationReference);
197
198public:
200 vtkMatrix3x3* GetSliceOrientationPreset(const std::string& name);
201
206 std::string GetSliceOrientationPresetName(vtkMatrix3x3* orientationMatrix);
207
209 void GetSliceOrientationPresetNames(vtkStringArray* presetOrientationNames);
210
214
219 bool AddSliceOrientationPreset(const std::string& name, vtkMatrix3x3* orientationMatrix);
220
224 bool RemoveSliceOrientationPreset(const std::string& name);
225
229 bool RenameSliceOrientationPreset(const std::string& name, const std::string& updatedName);
230
234 bool HasSliceOrientationPreset(const std::string& name);
235
238 static const char* GetReformatOrientationName() { return "Reformat"; }
239
243 static void GetAxialSliceToRASMatrix(vtkMatrix3x3* orientationMatrix, bool patientRightIsScreenLeft = true);
244
248 static void GetSagittalSliceToRASMatrix(vtkMatrix3x3* orientationMatrix, bool patientRightIsScreenLeft = true);
249
253 static void GetCoronalSliceToRASMatrix(vtkMatrix3x3* orientationMatrix, bool patientRightIsScreenLeft = true);
254
260 static void AddDefaultSliceOrientationPresets(vtkMRMLScene* scene, bool patientRightIsScreenLeft = true);
261
264 vtkGetVector3Macro(FieldOfView, double);
265 void SetFieldOfView(double x, double y, double z);
266 void SetFieldOfView(double xyz[3]) { SetFieldOfView(xyz[0], xyz[1], xyz[2]); }
267
270 vtkGetVector3Macro(XYZOrigin, double);
271 void SetXYZOrigin(double x, double y, double z);
272 void SetXYZOrigin(double xyz[3]) { SetXYZOrigin(xyz[0], xyz[1], xyz[2]); }
273
277 vtkGetVectorMacro(Dimensions, int, 3);
278 void SetDimensions(int x, int y, int z);
279 void SetDimensions(int xyz[3]) { SetDimensions(xyz[0], xyz[1], xyz[2]); }
280
288 vtkGetVectorMacro(UVWDimensions, int, 3);
289 void SetUVWDimensions(int x, int y, int z);
290 void SetUVWDimensions(int xyz[3]);
291
294 vtkGetVectorMacro(UVWMaximumDimensions, int, 3);
295 void SetUVWMaximumDimensions(int x, int y, int z);
296 void SetUVWMaximumDimensions(int xyz[3]);
297
300 vtkGetVector3Macro(UVWExtents, double);
301 void SetUVWExtents(double x, double y, double z);
302 void SetUVWExtents(double xyz[3]);
303
306 vtkGetVector3Macro(UVWOrigin, double);
307 void SetUVWOrigin(double x, double y, double z);
308 void SetUVWOrigin(double xyz[3]);
309
312 void SetSliceOrigin(double xyz[3]);
313 void SetSliceOrigin(double x, double y, double z);
314
318 void SetUVWExtentsAndDimensions(double extents[3], int dimensions[3]);
319
323 vtkMatrix4x4* GetXYToSlice();
324
328 vtkMatrix4x4* GetXYToRAS();
329
333 vtkMatrix4x4* GetUVWToSlice();
334
338 vtkMatrix4x4* GetUVWToRAS();
339
342 bool MatrixAreEqual(const vtkMatrix4x4* m1, const vtkMatrix4x4* m2);
343
344 bool MatrixAreEqual(const vtkMatrix4x4* matrix, const vtkMatrix3x3* orientationMatrix);
349
353 void SetLayoutGrid(int rows, int columns);
354
357 vtkGetMacro(LayoutGridRows, int);
358 virtual void SetLayoutGridRows(int rows);
359
362 vtkGetMacro(LayoutGridColumns, int);
363 virtual void SetLayoutGridColumns(int cols);
364
371 void SetSliceToRASByNTP(double Nx, double Ny, double Nz, double Tx, double Ty, double Tz, double Px, double Py, double Pz, int Orientation);
372
376 void JumpSlice(double r, double a, double s);
377 void JumpAllSlices(double r, double a, double s);
384 static void
385 JumpAllSlices(vtkMRMLScene* scene, double r, double a, double s, int jumpMode = vtkMRMLSliceNode::DefaultJumpSlice, int viewGroup = -1, vtkMRMLSliceNode* exclude = nullptr);
386 void JumpSliceByOffsetting(double r, double a, double s);
387 void JumpSliceByOffsetting(int k, double r, double a, double s);
388 void JumpSliceByCentering(double r, double a, double s);
389
391 enum
392 {
396 };
397
403 vtkSetMacro(JumpMode, int);
404 vtkGetMacro(JumpMode, int);
407
410 enum
411 {
414 };
415
419 vtkGetMacro(SliceSpacingMode, int);
420 vtkSetMacro(SliceSpacingMode, int);
423
427 vtkSetVector3Macro(PrescribedSliceSpacing, double);
428 vtkGetVector3Macro(PrescribedSliceSpacing, double);
429
433 void SetSliceOffset(double offset);
434
437 vtkSetMacro(ActiveSlice, int);
438 vtkGetMacro(ActiveSlice, int);
439
447 void RotateToVolumePlane(vtkMRMLVolumeNode* volumeNode, bool forceSlicePlaneToSingleSlice = true);
448
456 void RotateToAxes(vtkMatrix4x4* referenceToRAS, int sliceNormalAxisIndex = -1);
457
463 void SetInteracting(int);
464 vtkGetMacro(Interacting, int);
465 vtkBooleanMacro(Interacting, int);
466
484 {
485 None = 0,
487 FieldOfViewFlag = 2, // broadcast a specific field of view setting
489 ResetFieldOfViewFlag = 8, // broadcast a reset to all viewers
490 MultiplanarReformatFlag = 16, // broadcast reformat widget transformation
499 };
500
506 void SetInteractionFlags(unsigned int);
507 vtkGetMacro(InteractionFlags, unsigned int);
508
514 void SetInteractionFlagsModifier(unsigned int);
515 vtkGetMacro(InteractionFlagsModifier, unsigned int);
516
521
523
532
535 virtual void SetSliceResolutionMode(int mode);
536 vtkGetMacro(SliceResolutionMode, int);
537
540 vtkGetMacro(SlabReconstructionEnabled, bool);
541 vtkSetMacro(SlabReconstructionEnabled, bool);
542 vtkBooleanMacro(SlabReconstructionEnabled, bool);
544
547 vtkGetMacro(SlabReconstructionType, int);
548 vtkSetMacro(SlabReconstructionType, int);
549 static const char* GetSlabReconstructionTypeAsString(int slabReconstructionType);
550 static int GetSlabReconstructionTypeFromString(const char* name);
552
555 vtkGetMacro(SlabReconstructionThickness, double);
556 vtkSetMacro(SlabReconstructionThickness, double);
558
564
565 virtual vtkImplicitFunction* GetImplicitFunctionWorld();
566
567protected:
572
573 vtkSmartPointer<vtkMatrix4x4> SliceToRAS;
574
575 vtkSmartPointer<vtkMatrix4x4> XYToSlice;
576 vtkSmartPointer<vtkMatrix4x4> XYToRAS;
577
578 vtkSmartPointer<vtkMatrix4x4> UVWToSlice;
579 vtkSmartPointer<vtkMatrix4x4> UVWToRAS;
580
581 typedef std::pair<std::string, vtkSmartPointer<vtkMatrix3x3>> OrientationPresetType;
582 std::vector<OrientationPresetType> OrientationMatrices;
583
585
592
593 double FieldOfView[3];
594 double XYZOrigin[3];
595 double UVWOrigin[3];
597
599 double UVWExtents[3];
602
607
608 // Hold the string returned by GetOrientationString
609 std::string OrientationString;
610
612
614
617
620
622
624 unsigned int InteractionFlags;
626
628
629 std::vector<std::string> ThreeDViewIDs;
630
631 vtkSmartPointer<vtkPlane> ImplicitFunction;
632};
633
634//----------------------------------------------------------------------------
635std::vector<std::string> vtkMRMLSliceNode::GetThreeDViewIDs() const
636{
637 return this->ThreeDViewIDs;
638}
639
640#endif
friend class vtkMRMLScene
void SetInteracting(int)
void ResetInteractionFlagsModifier()
bool IsDisplayableInThreeDView(const char *viewNodeID) const
void ReadXMLAttributes(const char **atts) override
Set node attributes.
void SetXYZOrigin(double xyz[3])
void SetSliceToRASByNTP(double Nx, double Ny, double Nz, double Tx, double Ty, double Tz, double Px, double Py, double Pz, int Orientation)
void SetSliceOffset(double offset)
virtual const char * GetOrientationString()
Get orientation.
void SetInteractionFlags(unsigned int)
bool SetOrientationToSagittal()
void JumpSlice(double r, double a, double s)
void RotateToAxes(vtkMatrix4x4 *referenceToRAS, int sliceNormalAxisIndex=-1)
const char * GetNthThreeDViewID(unsigned int index)
bool RemoveSliceOrientationPreset(const std::string &name)
Remove an orientation preset.
void SetJumpModeToOffset()
void SetUVWExtentsAndDimensions(double extents[3], int dimensions[3])
unsigned int InteractionFlagsModifier
vtkMatrix4x4 * GetXYToSlice()
vtkMatrix4x4 * GetUVWToSlice()
double PrescribedSliceSpacing[3]
static void GetSagittalSliceToRASMatrix(vtkMatrix3x3 *orientationMatrix, bool patientRightIsScreenLeft=true)
Initialize orientationMatrix as a Sagittal orientation matrix.
bool MatrixAreEqual(const vtkMatrix4x4 *m1, const vtkMatrix4x4 *m2)
helper for comparing to matrices
static void GetCoronalSliceToRASMatrix(vtkMatrix3x3 *orientationMatrix, bool patientRightIsScreenLeft=true)
Initialize orientationMatrix as a Coronal orientation matrix.
void SetDimensions(int xyz[3])
void SetSliceSpacingModeToPrescribed()
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
void RemoveAllThreeDViewIDs()
void JumpSliceByOffsetting(double r, double a, double s)
void SetFieldOfView(double x, double y, double z)
static const char * GetReformatOrientationName()
void RotateToVolumePlane(vtkMRMLVolumeNode *volumeNode, bool forceSlicePlaneToSingleSlice=true)
virtual void SetSliceResolutionMode(int mode)
method for setting UVW space (extents, dimensions and spacing)
std::vector< OrientationPresetType > OrientationMatrices
static void AddDefaultSliceOrientationPresets(vtkMRMLScene *scene, bool patientRightIsScreenLeft=true)
Add default slice orientation presets to scene.
vtkMatrix4x4 * GetUVWToRAS()
vtkSmartPointer< vtkMatrix4x4 > SliceToRAS
void SetUVWOrigin(double x, double y, double z)
void JumpSliceByCentering(double r, double a, double s)
vtkMRMLSliceNode(const vtkMRMLSliceNode &)
std::string GetOrientation(vtkMatrix4x4 *sliceToRAS)
Return the orientation name associated with sliceToRAS.
bool RenameSliceOrientationPreset(const std::string &name, const std::string &updatedName)
Rename an orientation preset.
virtual vtkImplicitFunction * GetImplicitFunctionWorld()
bool AddSliceOrientationPreset(const std::string &name, vtkMatrix3x3 *orientationMatrix)
Add or update an orientation preset.
void PrintSelf(ostream &os, vtkIndent indent) override
static int GetSlabReconstructionTypeFromString(const char *name)
static const char * GetSlabReconstructionTypeAsString(int slabReconstructionType)
bool SetOrientation(const char *orientation)
Set orientation.
bool SetOrientationToAxial()
Set 'standard' radiological convention views of patient space.
void SetUVWExtents(double xyz[3])
bool SetOrientationToCoronal()
void Reset(vtkMRMLNode *defaultNode) override
Reimplemented to preserve orientation and layout color when reset.
unsigned int InteractionFlags
SliceResolutionModeType
Enum to specify the method for setting UVW extents.
bool IsThreeDViewIDPresent(const char *ThreeDViewID) const
bool MatrixAreEqual(const vtkMatrix4x4 *matrix, const vtkMatrix3x3 *orientationMatrix)
void RemoveThreeDViewID(char *viewNodeID)
void JumpAllSlices(double r, double a, double s)
void SetUVWDimensions(int xyz[3])
void operator=(const vtkMRMLSliceNode &)
void SetUVWMaximumDimensions(int x, int y, int z)
vtkMRMLNode * CreateNodeInstance() override
Create instance of the default node. Like New only virtual.
void GetSliceOrientationPresetNames(vtkStringArray *presetOrientationNames)
Return all the orientation preset names.
bool SetOrientationToDefault()
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
std::string GetSliceOrientationPresetName(vtkMatrix3x3 *orientationMatrix)
Return the preset name corresponding to orientationMatrix.
vtkMatrix3x3 * GetSliceOrientationPreset(const std::string &name)
Return the sliceToRAS matrix associated with name.
std::pair< std::string, vtkSmartPointer< vtkMatrix3x3 > > OrientationPresetType
vtkMRMLCopyContentMacro(vtkMRMLSliceNode)
double GetSliceOffset()
Get/Set the current distance from the origin to the slice plane.
void AddThreeDViewID(const char *viewNodeID)
int GetNumberOfThreeDViewIDs() const
vtkSmartPointer< vtkPlane > ImplicitFunction
double SlabReconstructionOversamplingFactor
virtual void SetLayoutGridColumns(int cols)
void SetSliceSpacingModeToAutomatic()
bool HasSliceOrientationPreset(const std::string &name)
Return True if an orientation preset is stored.
std::string OrientationString
void JumpSliceByOffsetting(int k, double r, double a, double s)
void SetUVWMaximumDimensions(int xyz[3])
static void JumpAllSlices(vtkMRMLScene *scene, double r, double a, double s, int jumpMode=vtkMRMLSliceNode::DefaultJumpSlice, int viewGroup=-1, vtkMRMLSliceNode *exclude=nullptr)
std::vector< std::string > GetThreeDViewIDs() const
std::vector< std::string > ThreeDViewIDs
std::string GetOrientation()
Get orientation.
void SetInteractionFlagsModifier(unsigned int)
void SetFieldOfView(double xyz[3])
double SlabReconstructionThickness
static void GetAxialSliceToRASMatrix(vtkMatrix3x3 *orientationMatrix, bool patientRightIsScreenLeft=true)
Initialize orientationMatrix as an Axial orientation matrix.
vtkSmartPointer< vtkMatrix4x4 > UVWToRAS
void SetSliceOrigin(double x, double y, double z)
virtual vtkMatrix4x4 * GetSliceToRAS()
~vtkMRMLSliceNode() override
vtkSmartPointer< vtkMatrix4x4 > UVWToSlice
virtual void SetLayoutGridRows(int rows)
void SetJumpModeToCentered()
void SetDimensions(int x, int y, int z)
int GetNumberOfSliceOrientationPresets() const
Return number of orientation presets.
vtkSmartPointer< vtkMatrix4x4 > XYToSlice
void SetUVWDimensions(int x, int y, int z)
vtkSmartPointer< vtkMatrix4x4 > XYToRAS
void SetXYZOrigin(double x, double y, double z)
vtkMatrix4x4 * GetXYToRAS()
static vtkMRMLSliceNode * New()
Instantiate a new Slice node without any orientation presets.
void SetSliceOrigin(double xyz[3])
Origin of slice in XYZ or UVW space depending on SliceResolutionMode.
void SetUVWExtents(double x, double y, double z)
void SetLayoutGrid(int rows, int columns)
void SetUVWOrigin(double xyz[3])
MRML node for representing a volume (image stack).