Slicer 5.4
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 vtkMatrix3x3;
24class vtkMatrix4x4;
25
32class VTK_MRML_EXPORT vtkMRMLSliceNode : public vtkMRMLAbstractViewNode
33{
34 public:
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44
46
49 void ReadXMLAttributes( const char** atts) override;
50
53 void WriteXML(ostream& of, int indent) override;
54
58
62 void Reset(vtkMRMLNode* defaultNode) override;
63
66 const char* GetNodeTagName() override {return "Slice";};
67
74 virtual vtkMatrix4x4 *GetSliceToRAS();
75
78 vtkGetMacro(SliceVisible, int);
79 vtkSetMacro(SliceVisible, int);
80
83 vtkGetMacro(WidgetVisible, int);
84 vtkSetMacro(WidgetVisible, int);
85
87 vtkGetMacro(WidgetOutlineVisible, int);
88 vtkSetMacro(WidgetOutlineVisible, int);
89
92 void AddThreeDViewID(const char* viewNodeID);
95 void RemoveThreeDViewID(char* viewNodeID);
106 const char* GetNthThreeDViewID(unsigned int index);
110 inline std::vector< std::string > GetThreeDViewIDs()const;
114 bool IsThreeDViewIDPresent(const char* ThreeDViewID)const;
119 bool IsDisplayableInThreeDView(const char* viewNodeID)const;
120
123 vtkGetMacro(WidgetNormalLockedToCamera, int);
124 vtkSetMacro(WidgetNormalLockedToCamera, int);
125
128 vtkGetMacro(UseLabelOutline, int);
129 vtkSetMacro(UseLabelOutline, int);
130 vtkBooleanMacro(UseLabelOutline, int);
131
141
145
152 std::string GetOrientation();
153
155 std::string GetOrientation(vtkMatrix4x4* sliceToRAS);
156
167 bool SetOrientation(const char* orientation);
168
173 vtkSetStringMacro(DefaultOrientation);
174 vtkGetStringMacro(DefaultOrientation);
175
179 virtual const char* GetOrientationString();
180
181protected:
182
187 vtkGetStringMacro(OrientationReference);
188 vtkSetStringMacro(OrientationReference);
189
190public:
191
193 vtkMatrix3x3 *GetSliceOrientationPreset(const std::string& name);
194
199 std::string GetSliceOrientationPresetName(vtkMatrix3x3* orientationMatrix);
200
202 void GetSliceOrientationPresetNames(vtkStringArray* presetOrientationNames);
203
207
212 bool AddSliceOrientationPreset(const std::string& name, vtkMatrix3x3* orientationMatrix);
213
217 bool RemoveSliceOrientationPreset(const std::string& name);
218
222 bool RenameSliceOrientationPreset(const std::string& name, const std::string& updatedName);
223
227 bool HasSliceOrientationPreset(const std::string& name);
228
231 static const char* GetReformatOrientationName() { return "Reformat"; }
232
236 static void GetAxialSliceToRASMatrix(vtkMatrix3x3* orientationMatrix, bool patientRightIsScreenLeft=true);
237
241 static void GetSagittalSliceToRASMatrix(vtkMatrix3x3* orientationMatrix, bool patientRightIsScreenLeft=true);
242
246 static void GetCoronalSliceToRASMatrix(vtkMatrix3x3* orientationMatrix, bool patientRightIsScreenLeft=true);
247
253 static void AddDefaultSliceOrientationPresets(vtkMRMLScene* scene, bool patientRightIsScreenLeft=true);
254
257 vtkGetVector3Macro(FieldOfView, double);
258 void SetFieldOfView(double x, double y, double z);
259 void SetFieldOfView(double xyz[3]) { SetFieldOfView(xyz[0], xyz[1], xyz[2]); }
260
263 vtkGetVector3Macro(XYZOrigin, double);
264 void SetXYZOrigin(double x, double y, double z);
265 void SetXYZOrigin(double xyz[3]) { SetXYZOrigin(xyz[0], xyz[1], xyz[2]); }
266
267
271 vtkGetVectorMacro(Dimensions,int,3)
272 void SetDimensions(int x, int y, int z);
273 void SetDimensions(int xyz[3]) { SetDimensions(xyz[0], xyz[1], xyz[2]); }
274
282 vtkGetVectorMacro(UVWDimensions,int,3)
283 void SetUVWDimensions(int x, int y, int z);
284 void SetUVWDimensions(int xyz[3]);
285
288 vtkGetVectorMacro(UVWMaximumDimensions,int,3)
289 void SetUVWMaximumDimensions(int x, int y, int z);
290 void SetUVWMaximumDimensions(int xyz[3]);
291
294 vtkGetVector3Macro(UVWExtents, double);
295 void SetUVWExtents(double x, double y, double z);
296 void SetUVWExtents(double xyz[3]);
297
300 vtkGetVector3Macro(UVWOrigin, double);
301 void SetUVWOrigin(double x, double y, double z);
302 void SetUVWOrigin(double xyz[3]);
303
306 void SetSliceOrigin(double xyz[3]);
307 void SetSliceOrigin(double x, double y, double z);
308
312 void SetUVWExtentsAndDimensions (double extents[3], int dimensions[3]);
313
314
318 vtkMatrix4x4 *GetXYToSlice();
319
323 vtkMatrix4x4 *GetXYToRAS();
324
328 vtkMatrix4x4 *GetUVWToSlice();
329
333 vtkMatrix4x4 *GetUVWToRAS();
334
337 bool MatrixAreEqual(const vtkMatrix4x4 *m1, const vtkMatrix4x4 *m2);
338
339 bool MatrixAreEqual(const vtkMatrix4x4 *matrix,
340 const vtkMatrix3x3 *orientationMatrix);
344 void UpdateMatrices();
345
349 void SetLayoutGrid( int rows, int columns );
350
353 vtkGetMacro(LayoutGridRows, int);
354 virtual void SetLayoutGridRows(int rows);
355
358 vtkGetMacro(LayoutGridColumns, int);
359 virtual void SetLayoutGridColumns(int cols);
360
367 void SetSliceToRASByNTP(double Nx, double Ny, double Nz,
368 double Tx, double Ty, double Tz,
369 double Px, double Py, double Pz,
370 int Orientation);
371
375 void JumpSlice(double r, double a, double s);
376 void JumpAllSlices(double r, double a, double s);
383 static void JumpAllSlices(vtkMRMLScene* scene, double r, double a, double s,
384 int jumpMode = vtkMRMLSliceNode::DefaultJumpSlice, int viewGroup = -1, vtkMRMLSliceNode* exclude = nullptr);
385 void JumpSliceByOffsetting(double r, double a, double s);
386 void JumpSliceByOffsetting(int k, double r, double a, double s);
387 void JumpSliceByCentering(double r, double a, double s);
388
390 enum {DefaultJumpSlice=-1, CenteredJumpSlice=0, OffsetJumpSlice};
391
397 vtkSetMacro(JumpMode, int);
398 vtkGetMacro(JumpMode, int);
401
404 enum {AutomaticSliceSpacingMode=0, PrescribedSliceSpacingMode};
405
409 vtkGetMacro(SliceSpacingMode, int);
410 vtkSetMacro(SliceSpacingMode, int);
413
417 vtkSetVector3Macro(PrescribedSliceSpacing, double);
418 vtkGetVector3Macro(PrescribedSliceSpacing, double);
419
423 void SetSliceOffset(double offset);
424
427 vtkSetMacro(ActiveSlice, int);
428 vtkGetMacro(ActiveSlice, int);
429
437 void RotateToVolumePlane(vtkMRMLVolumeNode *volumeNode, bool forceSlicePlaneToSingleSlice=true);
438
446 void RotateToAxes(vtkMatrix4x4 *referenceToRAS, int sliceNormalAxisIndex=-1);
447
453 void SetInteracting(int);
454 vtkGetMacro(Interacting, int);
455 vtkBooleanMacro(Interacting, int);
456
472 {
473 None = 0,
474 SliceToRASFlag = 1,
475 FieldOfViewFlag = 2, // broadcast a specific field of view setting
476 OrientationFlag = 4,
477 ResetFieldOfViewFlag = 8, // broadcast a reset to all viewers
478 MultiplanarReformatFlag = 16, // broadcast reformat widget transformation
479 XYZOriginFlag = 32,
480 LabelOutlineFlag = 64,
481 SliceVisibleFlag = 128,
482 SliceSpacingFlag = 256,
483 ResetOrientationFlag = 512,
484 RotateToBackgroundVolumePlaneFlag = 1024
485 };
486
492 void SetInteractionFlags(unsigned int);
493 vtkGetMacro(InteractionFlags, unsigned int);
494
500 void SetInteractionFlagsModifier(unsigned int);
501 vtkGetMacro(InteractionFlagsModifier, unsigned int);
502
507
508
509
511
520
523 virtual void SetSliceResolutionMode(int mode);
524 vtkGetMacro(SliceResolutionMode, int);
525
528 vtkGetMacro(SlabReconstructionEnabled, bool);
529 vtkSetMacro(SlabReconstructionEnabled, bool);
530 vtkBooleanMacro(SlabReconstructionEnabled, bool);
532
535 vtkGetMacro(SlabReconstructionType, int);
536 vtkSetMacro(SlabReconstructionType, int);
537 static const char* GetSlabReconstructionTypeAsString(int slabReconstructionType);
538 static int GetSlabReconstructionTypeFromString(const char* name);
540
543 vtkGetMacro(SlabReconstructionThickness, double);
544 vtkSetMacro(SlabReconstructionThickness, double);
546
549 vtkGetMacro(SlabReconstructionOversamplingFactor, double);
550 vtkSetMacro(SlabReconstructionOversamplingFactor, double);
552
553protected:
558
559 vtkSmartPointer<vtkMatrix4x4> SliceToRAS;
560
561 vtkSmartPointer<vtkMatrix4x4> XYToSlice;
562 vtkSmartPointer<vtkMatrix4x4> XYToRAS;
563
564 vtkSmartPointer<vtkMatrix4x4> UVWToSlice;
565 vtkSmartPointer<vtkMatrix4x4> UVWToRAS;
566
567 typedef std::pair <std::string, vtkSmartPointer<vtkMatrix3x3> > OrientationPresetType;
568 std::vector< OrientationPresetType > OrientationMatrices;
569
571
577
578 double FieldOfView[3];
579 double XYZOrigin[3];
580 double UVWOrigin[3];
581 int Dimensions[3];
582
584 double UVWExtents[3];
585 int UVWDimensions[3];
586 int UVWMaximumDimensions[3];
587
592
593 // Hold the string returned by GetOrientationString
594 std::string OrientationString;
595
597
599
602
604 double PrescribedSliceSpacing[3];
605
607
609 unsigned int InteractionFlags;
611
613
614 std::vector< std::string > ThreeDViewIDs;
615};
616
617//----------------------------------------------------------------------------
618std::vector< std::string > vtkMRMLSliceNode::GetThreeDViewIDs()const
619{
620 return this->ThreeDViewIDs;
621}
622
623#endif
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D,...
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.
MRML node for storing a slice through RAS space.
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 SetSliceOffset(double offset)
virtual const char * GetOrientationString()
Get orientation.
void SetInteractionFlags(unsigned int)
bool SetOrientationToSagittal()
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()
unsigned int InteractionFlagsModifier
static void GetSagittalSliceToRASMatrix(vtkMatrix3x3 *orientationMatrix, bool patientRightIsScreenLeft=true)
Initialize orientationMatrix as a Sagittal orientation matrix.
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 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)
static void AddDefaultSliceOrientationPresets(vtkMRMLScene *scene, bool patientRightIsScreenLeft=true)
Add default slice orientation presets to scene.
vtkSmartPointer< vtkMatrix4x4 > SliceToRAS
vtkMRMLSliceNode(const vtkMRMLSliceNode &)
std::vector< OrientationPresetType > OrientationMatrices
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.
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.
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
void RemoveThreeDViewID(char *viewNodeID)
void operator=(const vtkMRMLSliceNode &)
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
double SlabReconstructionOversamplingFactor
void SetSliceSpacingModeToAutomatic()
bool HasSliceOrientationPreset(const std::string &name)
Return True if an orientation preset is stored.
std::string OrientationString
std::vector< std::string > GetThreeDViewIDs() const
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.
std::vector< std::string > ThreeDViewIDs
vtkSmartPointer< vtkMatrix4x4 > UVWToRAS
virtual vtkMatrix4x4 * GetSliceToRAS()
~vtkMRMLSliceNode() override
vtkSmartPointer< vtkMatrix4x4 > UVWToSlice
void SetJumpModeToCentered()
int GetNumberOfSliceOrientationPresets() const
Return number of orientation presets.
vtkSmartPointer< vtkMatrix4x4 > XYToSlice
vtkSmartPointer< vtkMatrix4x4 > XYToRAS
void SetXYZOrigin(double x, double y, double z)
static vtkMRMLSliceNode * New()
Instantiate a new Slice node without any orientation presets.
MRML node for representing a volume (image stack).