Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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{
36 public:
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:
191
196 vtkGetStringMacro(OrientationReference);
197 vtkSetStringMacro(OrientationReference);
198
199public:
200
202 vtkMatrix3x3 *GetSliceOrientationPreset(const std::string& name);
203
208 std::string GetSliceOrientationPresetName(vtkMatrix3x3* orientationMatrix);
209
211 void GetSliceOrientationPresetNames(vtkStringArray* presetOrientationNames);
212
216
221 bool AddSliceOrientationPreset(const std::string& name, vtkMatrix3x3* orientationMatrix);
222
226 bool RemoveSliceOrientationPreset(const std::string& name);
227
231 bool RenameSliceOrientationPreset(const std::string& name, const std::string& updatedName);
232
236 bool HasSliceOrientationPreset(const std::string& name);
237
240 static const char* GetReformatOrientationName() { return "Reformat"; }
241
245 static void GetAxialSliceToRASMatrix(vtkMatrix3x3* orientationMatrix, bool patientRightIsScreenLeft=true);
246
250 static void GetSagittalSliceToRASMatrix(vtkMatrix3x3* orientationMatrix, bool patientRightIsScreenLeft=true);
251
255 static void GetCoronalSliceToRASMatrix(vtkMatrix3x3* orientationMatrix, bool patientRightIsScreenLeft=true);
256
262 static void AddDefaultSliceOrientationPresets(vtkMRMLScene* scene, bool patientRightIsScreenLeft=true);
263
266 vtkGetVector3Macro(FieldOfView, double);
267 void SetFieldOfView(double x, double y, double z);
268 void SetFieldOfView(double xyz[3]) { SetFieldOfView(xyz[0], xyz[1], xyz[2]); }
269
272 vtkGetVector3Macro(XYZOrigin, double);
273 void SetXYZOrigin(double x, double y, double z);
274 void SetXYZOrigin(double xyz[3]) { SetXYZOrigin(xyz[0], xyz[1], xyz[2]); }
275
276
280 vtkGetVectorMacro(Dimensions,int,3);
281 void SetDimensions(int x, int y, int z);
282 void SetDimensions(int xyz[3]) { SetDimensions(xyz[0], xyz[1], xyz[2]); }
283
291 vtkGetVectorMacro(UVWDimensions,int,3);
292 void SetUVWDimensions(int x, int y, int z);
293 void SetUVWDimensions(int xyz[3]);
294
297 vtkGetVectorMacro(UVWMaximumDimensions,int,3);
298 void SetUVWMaximumDimensions(int x, int y, int z);
299 void SetUVWMaximumDimensions(int xyz[3]);
300
303 vtkGetVector3Macro(UVWExtents, double);
304 void SetUVWExtents(double x, double y, double z);
305 void SetUVWExtents(double xyz[3]);
306
309 vtkGetVector3Macro(UVWOrigin, double);
310 void SetUVWOrigin(double x, double y, double z);
311 void SetUVWOrigin(double xyz[3]);
312
315 void SetSliceOrigin(double xyz[3]);
316 void SetSliceOrigin(double x, double y, double z);
317
321 void SetUVWExtentsAndDimensions (double extents[3], int dimensions[3]);
322
323
327 vtkMatrix4x4 *GetXYToSlice();
328
332 vtkMatrix4x4 *GetXYToRAS();
333
337 vtkMatrix4x4 *GetUVWToSlice();
338
342 vtkMatrix4x4 *GetUVWToRAS();
343
346 bool MatrixAreEqual(const vtkMatrix4x4 *m1, const vtkMatrix4x4 *m2);
347
348 bool MatrixAreEqual(const vtkMatrix4x4 *matrix,
349 const vtkMatrix3x3 *orientationMatrix);
354
358 void SetLayoutGrid( int rows, int columns );
359
362 vtkGetMacro(LayoutGridRows, int);
363 virtual void SetLayoutGridRows(int rows);
364
367 vtkGetMacro(LayoutGridColumns, int);
368 virtual void SetLayoutGridColumns(int cols);
369
376 void SetSliceToRASByNTP(double Nx, double Ny, double Nz,
377 double Tx, double Ty, double Tz,
378 double Px, double Py, double Pz,
379 int Orientation);
380
384 void JumpSlice(double r, double a, double s);
385 void JumpAllSlices(double r, double a, double s);
392 static void JumpAllSlices(vtkMRMLScene* scene, double r, double a, double s,
393 int jumpMode = vtkMRMLSliceNode::DefaultJumpSlice, int viewGroup = -1, vtkMRMLSliceNode* exclude = nullptr);
394 void JumpSliceByOffsetting(double r, double a, double s);
395 void JumpSliceByOffsetting(int k, double r, double a, double s);
396 void JumpSliceByCentering(double r, double a, double s);
397
400
406 vtkSetMacro(JumpMode, int);
407 vtkGetMacro(JumpMode, int);
410
414
418 vtkGetMacro(SliceSpacingMode, int);
419 vtkSetMacro(SliceSpacingMode, int);
422
426 vtkSetVector3Macro(PrescribedSliceSpacing, double);
427 vtkGetVector3Macro(PrescribedSliceSpacing, double);
428
432 void SetSliceOffset(double offset);
433
436 vtkSetMacro(ActiveSlice, int);
437 vtkGetMacro(ActiveSlice, int);
438
446 void RotateToVolumePlane(vtkMRMLVolumeNode *volumeNode, bool forceSlicePlaneToSingleSlice=true);
447
455 void RotateToAxes(vtkMatrix4x4 *referenceToRAS, int sliceNormalAxisIndex=-1);
456
462 void SetInteracting(int);
463 vtkGetMacro(Interacting, int);
464 vtkBooleanMacro(Interacting, int);
465
483 {
484 None = 0,
486 FieldOfViewFlag = 2, // broadcast a specific field of view setting
488 ResetFieldOfViewFlag = 8, // broadcast a reset to all viewers
489 MultiplanarReformatFlag = 16, // broadcast reformat widget transformation
498 };
499
505 void SetInteractionFlags(unsigned int);
506 vtkGetMacro(InteractionFlags, unsigned int);
507
513 void SetInteractionFlagsModifier(unsigned int);
514 vtkGetMacro(InteractionFlagsModifier, unsigned int);
515
520
521
522
524
533
536 virtual void SetSliceResolutionMode(int mode);
537 vtkGetMacro(SliceResolutionMode, int);
538
541 vtkGetMacro(SlabReconstructionEnabled, bool);
542 vtkSetMacro(SlabReconstructionEnabled, bool);
543 vtkBooleanMacro(SlabReconstructionEnabled, bool);
545
548 vtkGetMacro(SlabReconstructionType, int);
549 vtkSetMacro(SlabReconstructionType, int);
550 static const char* GetSlabReconstructionTypeAsString(int slabReconstructionType);
551 static int GetSlabReconstructionTypeFromString(const char* name);
553
556 vtkGetMacro(SlabReconstructionThickness, double);
557 vtkSetMacro(SlabReconstructionThickness, double);
559
565
566 virtual vtkImplicitFunction* GetImplicitFunctionWorld();
567
568protected:
573
574 vtkSmartPointer<vtkMatrix4x4> SliceToRAS;
575
576 vtkSmartPointer<vtkMatrix4x4> XYToSlice;
577 vtkSmartPointer<vtkMatrix4x4> XYToRAS;
578
579 vtkSmartPointer<vtkMatrix4x4> UVWToSlice;
580 vtkSmartPointer<vtkMatrix4x4> UVWToRAS;
581
582 typedef std::pair <std::string, vtkSmartPointer<vtkMatrix3x3> > OrientationPresetType;
583 std::vector< OrientationPresetType > OrientationMatrices;
584
586
593
594 double FieldOfView[3];
595 double XYZOrigin[3];
596 double UVWOrigin[3];
598
600 double UVWExtents[3];
603
608
609 // Hold the string returned by GetOrientationString
610 std::string OrientationString;
611
613
615
618
621
623
625 unsigned int InteractionFlags;
627
629
630 std::vector< std::string > ThreeDViewIDs;
631
632 vtkSmartPointer<vtkPlane> ImplicitFunction;
633};
634
635//----------------------------------------------------------------------------
636std::vector< std::string > vtkMRMLSliceNode::GetThreeDViewIDs()const
637{
638 return this->ThreeDViewIDs;
639}
640
641#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)
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::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.
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::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
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).