Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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
20 class vtkMRMLVolumeNode;
21 
22 // VTK includes
23 class vtkMatrix3x3;
24 class vtkMatrix4x4;
25 
32 class VTK_MRML_EXPORT vtkMRMLSliceNode : public vtkMRMLAbstractViewNode
33 {
34  public:
41  static vtkMRMLSliceNode *New();
43  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
44 
45  virtual vtkMRMLNode* CreateNodeInstance() VTK_OVERRIDE;
46 
49  virtual void ReadXMLAttributes( const char** atts) VTK_OVERRIDE;
50 
53  virtual void WriteXML(ostream& of, int indent) VTK_OVERRIDE;
54 
57  virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE;
58 
62  virtual void Reset(vtkMRMLNode* defaultNode) VTK_OVERRIDE;
63 
66  virtual const char* GetNodeTagName() VTK_OVERRIDE {return "Slice";};
67 
73  virtual vtkMatrix4x4 *GetSliceToRAS();
74 
77  vtkGetMacro ( SliceVisible, int );
78  vtkSetMacro ( SliceVisible, int );
79 
82  vtkGetMacro ( WidgetVisible, int );
83  vtkSetMacro ( WidgetVisible, int );
84 
87  void AddThreeDViewID(const char* viewNodeID);
90  void RemoveThreeDViewID(char* viewNodeID);
93  void RemoveAllThreeDViewIDs();
97  int GetNumberOfThreeDViewIDs()const;
101  const char* GetNthThreeDViewID(unsigned int index);
105  inline std::vector< std::string > GetThreeDViewIDs()const;
109  bool IsThreeDViewIDPresent(const char* ThreeDViewID)const;
114  bool IsDisplayableInThreeDView(const char* viewNodeID)const;
115 
118  vtkGetMacro ( WidgetNormalLockedToCamera, int );
119  vtkSetMacro ( WidgetNormalLockedToCamera, int );
120 
123  vtkGetMacro ( UseLabelOutline, int );
124  vtkSetMacro ( UseLabelOutline, int );
125  vtkBooleanMacro ( UseLabelOutline, int );
126 
133  bool SetOrientationToAxial();
134  bool SetOrientationToSagittal();
135  bool SetOrientationToCoronal();
136 
143  std::string GetOrientation();
144 
146  std::string GetOrientation(vtkMatrix4x4* sliceToRAS);
147 
158  bool SetOrientation(const char* orientation);
159 
163  virtual const char* GetOrientationString();
164 
165 protected:
166 
174  vtkGetStringMacro (OrientationReference);
175  vtkSetStringMacro (OrientationReference);
176 
177 public:
178 
180  vtkMatrix3x3 *GetSliceOrientationPreset(const std::string& name);
181 
186  std::string GetSliceOrientationPresetName(vtkMatrix3x3* orientationMatrix);
187 
189  void GetSliceOrientationPresetNames(vtkStringArray* presetOrientationNames);
190 
193  int GetNumberOfSliceOrientationPresets() const;
194 
199  bool AddSliceOrientationPreset(const std::string& name, vtkMatrix3x3* orientationMatrix);
200 
204  bool RemoveSliceOrientationPreset(const std::string& name);
205 
209  bool RenameSliceOrientationPreset(const std::string& name, const std::string& updatedName);
210 
214  bool HasSliceOrientationPreset(const std::string& name);
215 
217  static void InitializeAxialMatrix(vtkMatrix3x3* orientationMatrix);
218 
220  static void InitializeSagittalMatrix(vtkMatrix3x3* orientationMatrix);
221 
223  static void InitializeCoronalMatrix(vtkMatrix3x3* orientationMatrix);
224 
231  static void AddDefaultSliceOrientationPresets(vtkMRMLScene* scene);
232 
235  vtkGetVector3Macro (FieldOfView, double);
236  void SetFieldOfView (double x, double y, double z);
237 
240  vtkGetVector3Macro (XYZOrigin, double);
241  void SetXYZOrigin (double x, double y, double z);
242 
246  vtkGetVectorMacro(Dimensions,int,3)
247  void SetDimensions (int x, int y, int z);
248 
256  vtkGetVectorMacro(UVWDimensions,int,3)
257  void SetUVWDimensions (int x, int y, int z);
258  void SetUVWDimensions (int xyz[3]);
259 
262  vtkGetVectorMacro(UVWMaximumDimensions,int,3)
263  void SetUVWMaximumDimensions (int x, int y, int z);
264  void SetUVWMaximumDimensions (int xyz[3]);
265 
268  vtkGetVector3Macro (UVWExtents, double);
269  void SetUVWExtents (double x, double y, double z);
270  void SetUVWExtents (double xyz[3]);
271 
274  vtkGetVector3Macro (UVWOrigin, double);
275  void SetUVWOrigin (double x, double y, double z);
276  void SetUVWOrigin (double xyz[3]);
277 
280  void SetSliceOrigin (double xyz[3]);
281  void SetSliceOrigin (double x, double y, double z);
282 
286  void SetUVWExtentsAndDimensions (double extents[3], int dimensions[3]);
287 
288 
292  vtkMatrix4x4 *GetXYToSlice();
293 
297  vtkMatrix4x4 *GetXYToRAS();
298 
302  vtkMatrix4x4 *GetUVWToSlice();
303 
307  vtkMatrix4x4 *GetUVWToRAS();
308 
311  bool MatrixAreEqual(const vtkMatrix4x4 *m1, const vtkMatrix4x4 *m2);
312 
313  bool MatrixAreEqual(const vtkMatrix4x4 *matrix,
314  const vtkMatrix3x3 *orientationMatrix);
318  void UpdateMatrices();
319 
321  vtkSetVector3Macro(LayoutColor, double);
322  vtkGetVector3Macro(LayoutColor, double);
323 
324  static double* redColor();
325  static double* yellowColor();
326  static double* greenColor();
327  static double* compareColor();
328  static double* grayColor();
329 
333  void SetLayoutGrid( int rows, int columns );
334 
337  vtkGetMacro (LayoutGridRows, int);
338  virtual void SetLayoutGridRows(int rows);
339 
342  vtkGetMacro (LayoutGridColumns, int);
343  virtual void SetLayoutGridColumns(int cols);
344 
351  void SetSliceToRASByNTP (double Nx, double Ny, double Nz,
352  double Tx, double Ty, double Tz,
353  double Px, double Py, double Pz,
354  int Orientation);
355 
359  void JumpSlice(double r, double a, double s);
360  void JumpAllSlices(double r, double a, double s);
367  static void JumpAllSlices(vtkMRMLScene* scene, double r, double a, double s,
368  int jumpMode = vtkMRMLSliceNode::DefaultJumpSlice, int viewGroup = -1, vtkMRMLSliceNode* exclude = NULL);
369  void JumpSliceByOffsetting(double r, double a, double s);
370  void JumpSliceByOffsetting(int k, double r, double a, double s);
371  void JumpSliceByCentering(double r, double a, double s);
372 
374  enum {DefaultJumpSlice=-1, CenteredJumpSlice=0, OffsetJumpSlice};
375 
381  vtkSetMacro(JumpMode, int);
382  vtkGetMacro(JumpMode, int);
383  void SetJumpModeToCentered();
384  void SetJumpModeToOffset();
385 
388  enum {AutomaticSliceSpacingMode=0, PrescribedSliceSpacingMode};
389 
393  vtkGetMacro(SliceSpacingMode, int);
394  vtkSetMacro(SliceSpacingMode, int);
395  void SetSliceSpacingModeToAutomatic();
396  void SetSliceSpacingModeToPrescribed();
397 
401  vtkSetVector3Macro(PrescribedSliceSpacing, double);
402  vtkGetVector3Macro(PrescribedSliceSpacing, double);
403 
406  double GetSliceOffset();
407  void SetSliceOffset(double offset);
408 
411  vtkSetMacro(ActiveSlice, int);
412  vtkGetMacro(ActiveSlice, int);
413 
418  void RotateToVolumePlane(vtkMRMLVolumeNode *volumeNode);
419 
425  void SetInteracting(int);
426  vtkGetMacro(Interacting, int);
427  vtkBooleanMacro(Interacting, int);
428 
443  {
444  None = 0,
445  SliceToRASFlag = 1,
446  FieldOfViewFlag = 2, // broadcast a specific field of view setting
447  OrientationFlag = 4,
448  ResetFieldOfViewFlag = 8, // broadcast a reset to all viewers
449  MultiplanarReformatFlag = 16, // broadcast reformat widget transformation
450  XYZOriginFlag = 32,
451  LabelOutlineFlag = 64,
452  SliceVisibleFlag = 128,
453  SliceSpacingFlag = 256
454  // Next one needs to be 512
455  };
456 
462  void SetInteractionFlags(unsigned int);
463  vtkGetMacro(InteractionFlags, unsigned int);
464 
470  void SetInteractionFlagsModifier(unsigned int);
471  vtkGetMacro(InteractionFlagsModifier, unsigned int);
472 
476  void ResetInteractionFlagsModifier();
477 
478 
479 
481 
483  {
484  SliceResolutionMatchVolumes=0,
488  SliceResolutionCustom
489  };
490 
493  virtual void SetSliceResolutionMode(int mode);
494  vtkGetMacro(SliceResolutionMode, int);
495 
496 protected:
497 
498 
500  ~vtkMRMLSliceNode();
502  void operator=(const vtkMRMLSliceNode&);
503 
504  vtkSmartPointer<vtkMatrix4x4> SliceToRAS;
505 
506  vtkSmartPointer<vtkMatrix4x4> XYToSlice;
507  vtkSmartPointer<vtkMatrix4x4> XYToRAS;
508 
509  vtkSmartPointer<vtkMatrix4x4> UVWToSlice;
510  vtkSmartPointer<vtkMatrix4x4> UVWToRAS;
511 
512  typedef std::pair <std::string, vtkSmartPointer<vtkMatrix3x3> > OrientationPresetType;
513  std::vector< OrientationPresetType > OrientationMatrices;
514 
515  int JumpMode;
516 
521 
522  double FieldOfView[3];
523  double XYZOrigin[3];
524  double UVWOrigin[3];
525  int Dimensions[3];
526 
528  double UVWExtents[3];
529  int UVWDimensions[3];
530  int UVWMaximumDimensions[3];
531 
532  // Hold the string returned by GetOrientationString
533  std::string OrientationString;
534 
536 
537  double LayoutColor[3];
538 
541 
543  double PrescribedSliceSpacing[3];
544 
546 
548  unsigned int InteractionFlags;
550 
552 
553  std::vector< std::string > ThreeDViewIDs;
554 };
555 
556 //----------------------------------------------------------------------------
557 std::vector< std::string > vtkMRMLSliceNode::GetThreeDViewIDs()const
558 {
559  return this->ThreeDViewIDs;
560 }
561 
562 #endif
unsigned int InteractionFlagsModifier
std::vector< std::string > ThreeDViewIDs
unsigned int InteractionFlags
MRML node for storing a slice through RAS space.
vtkSmartPointer< vtkMatrix4x4 > UVWToRAS
vtkSmartPointer< vtkMatrix4x4 > XYToRAS
void operator=(const vtkMRMLAbstractViewNode &)
virtual vtkMRMLNode * CreateNodeInstance()=0
Create instance of the default node. Like New only virtual.
vtkSmartPointer< vtkMatrix4x4 > SliceToRAS
std::vector< std::string > GetThreeDViewIDs() const
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D...
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
std::vector< OrientationPresetType > OrientationMatrices
MRML node for representing a volume (image stack).
vtkSmartPointer< vtkMatrix4x4 > XYToSlice
SliceResolutionModeType
Enum to specify the method for setting UVW extents.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
vtkSmartPointer< vtkMatrix4x4 > UVWToSlice
std::pair< std::string, vtkSmartPointer< vtkMatrix3x3 > > OrientationPresetType
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
std::string OrientationString