Slicer  4.10
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
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 
86  vtkGetMacro(WidgetOutlineVisible, int);
87  vtkSetMacro(WidgetOutlineVisible, int);
88 
91  void AddThreeDViewID(const char* viewNodeID);
94  void RemoveThreeDViewID(char* viewNodeID);
97  void RemoveAllThreeDViewIDs();
101  int GetNumberOfThreeDViewIDs()const;
105  const char* GetNthThreeDViewID(unsigned int index);
109  inline std::vector< std::string > GetThreeDViewIDs()const;
113  bool IsThreeDViewIDPresent(const char* ThreeDViewID)const;
118  bool IsDisplayableInThreeDView(const char* viewNodeID)const;
119 
122  vtkGetMacro(WidgetNormalLockedToCamera, int);
123  vtkSetMacro(WidgetNormalLockedToCamera, int);
124 
127  vtkGetMacro(UseLabelOutline, int);
128  vtkSetMacro(UseLabelOutline, int);
129  vtkBooleanMacro(UseLabelOutline, int);
130 
137  bool SetOrientationToAxial();
138  bool SetOrientationToSagittal();
139  bool SetOrientationToCoronal();
140 
147  std::string GetOrientation();
148 
150  std::string GetOrientation(vtkMatrix4x4* sliceToRAS);
151 
162  bool SetOrientation(const char* orientation);
163 
167  virtual const char* GetOrientationString();
168 
169 protected:
170 
175  vtkGetStringMacro(OrientationReference);
176  vtkSetStringMacro(OrientationReference);
177 
178 public:
179 
181  vtkMatrix3x3 *GetSliceOrientationPreset(const std::string& name);
182 
187  std::string GetSliceOrientationPresetName(vtkMatrix3x3* orientationMatrix);
188 
190  void GetSliceOrientationPresetNames(vtkStringArray* presetOrientationNames);
191 
194  int GetNumberOfSliceOrientationPresets() const;
195 
200  bool AddSliceOrientationPreset(const std::string& name, vtkMatrix3x3* orientationMatrix);
201 
205  bool RemoveSliceOrientationPreset(const std::string& name);
206 
210  bool RenameSliceOrientationPreset(const std::string& name, const std::string& updatedName);
211 
215  bool HasSliceOrientationPreset(const std::string& name);
216 
218  static void InitializeAxialMatrix(vtkMatrix3x3* orientationMatrix);
219 
221  static void InitializeSagittalMatrix(vtkMatrix3x3* orientationMatrix);
222 
224  static void InitializeCoronalMatrix(vtkMatrix3x3* orientationMatrix);
225 
232  static void AddDefaultSliceOrientationPresets(vtkMRMLScene* scene);
233 
236  vtkGetVector3Macro(FieldOfView, double);
237  void SetFieldOfView(double x, double y, double z);
238 
241  vtkGetVector3Macro(XYZOrigin, double);
242  void SetXYZOrigin(double x, double y, double z);
243 
247  vtkGetVectorMacro(Dimensions,int,3)
248  void SetDimensions(int x, int y, int z);
249 
257  vtkGetVectorMacro(UVWDimensions,int,3)
258  void SetUVWDimensions(int x, int y, int z);
259  void SetUVWDimensions(int xyz[3]);
260 
263  vtkGetVectorMacro(UVWMaximumDimensions,int,3)
264  void SetUVWMaximumDimensions(int x, int y, int z);
265  void SetUVWMaximumDimensions(int xyz[3]);
266 
269  vtkGetVector3Macro(UVWExtents, double);
270  void SetUVWExtents(double x, double y, double z);
271  void SetUVWExtents(double xyz[3]);
272 
275  vtkGetVector3Macro(UVWOrigin, double);
276  void SetUVWOrigin(double x, double y, double z);
277  void SetUVWOrigin(double xyz[3]);
278 
281  void SetSliceOrigin(double xyz[3]);
282  void SetSliceOrigin(double x, double y, double z);
283 
287  void SetUVWExtentsAndDimensions (double extents[3], int dimensions[3]);
288 
289 
293  vtkMatrix4x4 *GetXYToSlice();
294 
298  vtkMatrix4x4 *GetXYToRAS();
299 
303  vtkMatrix4x4 *GetUVWToSlice();
304 
308  vtkMatrix4x4 *GetUVWToRAS();
309 
312  bool MatrixAreEqual(const vtkMatrix4x4 *m1, const vtkMatrix4x4 *m2);
313 
314  bool MatrixAreEqual(const vtkMatrix4x4 *matrix,
315  const vtkMatrix3x3 *orientationMatrix);
319  void UpdateMatrices();
320 
324  void SetLayoutGrid( int rows, int columns );
325 
328  vtkGetMacro(LayoutGridRows, int);
329  virtual void SetLayoutGridRows(int rows);
330 
333  vtkGetMacro(LayoutGridColumns, int);
334  virtual void SetLayoutGridColumns(int cols);
335 
342  void SetSliceToRASByNTP(double Nx, double Ny, double Nz,
343  double Tx, double Ty, double Tz,
344  double Px, double Py, double Pz,
345  int Orientation);
346 
350  void JumpSlice(double r, double a, double s);
351  void JumpAllSlices(double r, double a, double s);
358  static void JumpAllSlices(vtkMRMLScene* scene, double r, double a, double s,
359  int jumpMode = vtkMRMLSliceNode::DefaultJumpSlice, int viewGroup = -1, vtkMRMLSliceNode* exclude = NULL);
360  void JumpSliceByOffsetting(double r, double a, double s);
361  void JumpSliceByOffsetting(int k, double r, double a, double s);
362  void JumpSliceByCentering(double r, double a, double s);
363 
365  enum {DefaultJumpSlice=-1, CenteredJumpSlice=0, OffsetJumpSlice};
366 
372  vtkSetMacro(JumpMode, int);
373  vtkGetMacro(JumpMode, int);
374  void SetJumpModeToCentered();
375  void SetJumpModeToOffset();
376 
379  enum {AutomaticSliceSpacingMode=0, PrescribedSliceSpacingMode};
380 
384  vtkGetMacro(SliceSpacingMode, int);
385  vtkSetMacro(SliceSpacingMode, int);
386  void SetSliceSpacingModeToAutomatic();
387  void SetSliceSpacingModeToPrescribed();
388 
392  vtkSetVector3Macro(PrescribedSliceSpacing, double);
393  vtkGetVector3Macro(PrescribedSliceSpacing, double);
394 
397  double GetSliceOffset();
398  void SetSliceOffset(double offset);
399 
402  vtkSetMacro(ActiveSlice, int);
403  vtkGetMacro(ActiveSlice, int);
404 
411  void RotateToVolumePlane(vtkMRMLVolumeNode *volumeNode);
412 
420  void RotateToAxes(vtkMatrix4x4 *referenceToRAS, int sliceNormalAxisIndex=-1);
421 
427  void SetInteracting(int);
428  vtkGetMacro(Interacting, int);
429  vtkBooleanMacro(Interacting, int);
430 
445  {
446  None = 0,
447  SliceToRASFlag = 1,
448  FieldOfViewFlag = 2, // broadcast a specific field of view setting
449  OrientationFlag = 4,
450  ResetFieldOfViewFlag = 8, // broadcast a reset to all viewers
451  MultiplanarReformatFlag = 16, // broadcast reformat widget transformation
452  XYZOriginFlag = 32,
453  LabelOutlineFlag = 64,
454  SliceVisibleFlag = 128,
455  SliceSpacingFlag = 256
456  // Next one needs to be 512
457  };
458 
464  void SetInteractionFlags(unsigned int);
465  vtkGetMacro(InteractionFlags, unsigned int);
466 
472  void SetInteractionFlagsModifier(unsigned int);
473  vtkGetMacro(InteractionFlagsModifier, unsigned int);
474 
478  void ResetInteractionFlagsModifier();
479 
480 
481 
483 
485  {
486  SliceResolutionMatchVolumes=0,
490  SliceResolutionCustom
491  };
492 
495  virtual void SetSliceResolutionMode(int mode);
496  vtkGetMacro(SliceResolutionMode, int);
497 
498 protected:
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 
522 
523  double FieldOfView[3];
524  double XYZOrigin[3];
525  double UVWOrigin[3];
526  int Dimensions[3];
527 
529  double UVWExtents[3];
530  int UVWDimensions[3];
531  int UVWMaximumDimensions[3];
532 
533  // Hold the string returned by GetOrientationString
534  std::string OrientationString;
535 
537 
540 
542  double PrescribedSliceSpacing[3];
543 
545 
547  unsigned int InteractionFlags;
549 
551 
552  std::vector< std::string > ThreeDViewIDs;
553 };
554 
555 //----------------------------------------------------------------------------
556 std::vector< std::string > vtkMRMLSliceNode::GetThreeDViewIDs()const
557 {
558  return this->ThreeDViewIDs;
559 }
560 
561 #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:138
vtkSmartPointer< vtkMatrix4x4 > UVWToSlice
std::pair< std::string, vtkSmartPointer< vtkMatrix3x3 > > OrientationPresetType
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
std::string OrientationString