Slicer  4.11
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) override;
44 
45  vtkMRMLNode* CreateNodeInstance() override;
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);
98  void RemoveAllThreeDViewIDs();
102  int GetNumberOfThreeDViewIDs()const;
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 
138  bool SetOrientationToAxial();
139  bool SetOrientationToSagittal();
140  bool SetOrientationToCoronal();
141 
144  bool SetOrientationToDefault();
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 
181 protected:
182 
187  vtkGetStringMacro(OrientationReference);
188  vtkSetStringMacro(OrientationReference);
189 
190 public:
191 
193  vtkMatrix3x3 *GetSliceOrientationPreset(const std::string& name);
194 
199  std::string GetSliceOrientationPresetName(vtkMatrix3x3* orientationMatrix);
200 
202  void GetSliceOrientationPresetNames(vtkStringArray* presetOrientationNames);
203 
206  int GetNumberOfSliceOrientationPresets() const;
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 
234  static void InitializeAxialMatrix(vtkMatrix3x3* orientationMatrix);
235 
237  static void InitializeSagittalMatrix(vtkMatrix3x3* orientationMatrix);
238 
240  static void InitializeCoronalMatrix(vtkMatrix3x3* orientationMatrix);
241 
248  static void AddDefaultSliceOrientationPresets(vtkMRMLScene* scene);
249 
252  vtkGetVector3Macro(FieldOfView, double);
253  void SetFieldOfView(double x, double y, double z);
254 
257  vtkGetVector3Macro(XYZOrigin, double);
258  void SetXYZOrigin(double x, double y, double z);
259 
263  vtkGetVectorMacro(Dimensions,int,3)
264  void SetDimensions(int x, int y, int z);
265 
273  vtkGetVectorMacro(UVWDimensions,int,3)
274  void SetUVWDimensions(int x, int y, int z);
275  void SetUVWDimensions(int xyz[3]);
276 
279  vtkGetVectorMacro(UVWMaximumDimensions,int,3)
280  void SetUVWMaximumDimensions(int x, int y, int z);
281  void SetUVWMaximumDimensions(int xyz[3]);
282 
285  vtkGetVector3Macro(UVWExtents, double);
286  void SetUVWExtents(double x, double y, double z);
287  void SetUVWExtents(double xyz[3]);
288 
291  vtkGetVector3Macro(UVWOrigin, double);
292  void SetUVWOrigin(double x, double y, double z);
293  void SetUVWOrigin(double xyz[3]);
294 
297  void SetSliceOrigin(double xyz[3]);
298  void SetSliceOrigin(double x, double y, double z);
299 
303  void SetUVWExtentsAndDimensions (double extents[3], int dimensions[3]);
304 
305 
309  vtkMatrix4x4 *GetXYToSlice();
310 
314  vtkMatrix4x4 *GetXYToRAS();
315 
319  vtkMatrix4x4 *GetUVWToSlice();
320 
324  vtkMatrix4x4 *GetUVWToRAS();
325 
328  bool MatrixAreEqual(const vtkMatrix4x4 *m1, const vtkMatrix4x4 *m2);
329 
330  bool MatrixAreEqual(const vtkMatrix4x4 *matrix,
331  const vtkMatrix3x3 *orientationMatrix);
335  void UpdateMatrices();
336 
340  void SetLayoutGrid( int rows, int columns );
341 
344  vtkGetMacro(LayoutGridRows, int);
345  virtual void SetLayoutGridRows(int rows);
346 
349  vtkGetMacro(LayoutGridColumns, int);
350  virtual void SetLayoutGridColumns(int cols);
351 
358  void SetSliceToRASByNTP(double Nx, double Ny, double Nz,
359  double Tx, double Ty, double Tz,
360  double Px, double Py, double Pz,
361  int Orientation);
362 
366  void JumpSlice(double r, double a, double s);
367  void JumpAllSlices(double r, double a, double s);
374  static void JumpAllSlices(vtkMRMLScene* scene, double r, double a, double s,
375  int jumpMode = vtkMRMLSliceNode::DefaultJumpSlice, int viewGroup = -1, vtkMRMLSliceNode* exclude = nullptr);
376  void JumpSliceByOffsetting(double r, double a, double s);
377  void JumpSliceByOffsetting(int k, double r, double a, double s);
378  void JumpSliceByCentering(double r, double a, double s);
379 
381  enum {DefaultJumpSlice=-1, CenteredJumpSlice=0, OffsetJumpSlice};
382 
388  vtkSetMacro(JumpMode, int);
389  vtkGetMacro(JumpMode, int);
390  void SetJumpModeToCentered();
391  void SetJumpModeToOffset();
392 
395  enum {AutomaticSliceSpacingMode=0, PrescribedSliceSpacingMode};
396 
400  vtkGetMacro(SliceSpacingMode, int);
401  vtkSetMacro(SliceSpacingMode, int);
402  void SetSliceSpacingModeToAutomatic();
403  void SetSliceSpacingModeToPrescribed();
404 
408  vtkSetVector3Macro(PrescribedSliceSpacing, double);
409  vtkGetVector3Macro(PrescribedSliceSpacing, double);
410 
413  double GetSliceOffset();
414  void SetSliceOffset(double offset);
415 
418  vtkSetMacro(ActiveSlice, int);
419  vtkGetMacro(ActiveSlice, int);
420 
428  void RotateToVolumePlane(vtkMRMLVolumeNode *volumeNode, bool forceSlicePlaneToSingleSlice=true);
429 
437  void RotateToAxes(vtkMatrix4x4 *referenceToRAS, int sliceNormalAxisIndex=-1);
438 
444  void SetInteracting(int);
445  vtkGetMacro(Interacting, int);
446  vtkBooleanMacro(Interacting, int);
447 
463  {
464  None = 0,
465  SliceToRASFlag = 1,
466  FieldOfViewFlag = 2, // broadcast a specific field of view setting
467  OrientationFlag = 4,
468  ResetFieldOfViewFlag = 8, // broadcast a reset to all viewers
469  MultiplanarReformatFlag = 16, // broadcast reformat widget transformation
470  XYZOriginFlag = 32,
471  LabelOutlineFlag = 64,
472  SliceVisibleFlag = 128,
473  SliceSpacingFlag = 256,
474  ResetOrientationFlag = 512,
475  RotateToBackgroundVolumePlaneFlag = 1024
476  };
477 
483  void SetInteractionFlags(unsigned int);
484  vtkGetMacro(InteractionFlags, unsigned int);
485 
491  void SetInteractionFlagsModifier(unsigned int);
492  vtkGetMacro(InteractionFlagsModifier, unsigned int);
493 
497  void ResetInteractionFlagsModifier();
498 
499 
500 
502 
504  {
505  SliceResolutionMatchVolumes=0,
509  SliceResolutionCustom
510  };
511 
514  virtual void SetSliceResolutionMode(int mode);
515  vtkGetMacro(SliceResolutionMode, int);
516 
517 protected:
519  ~vtkMRMLSliceNode() override;
521  void operator=(const vtkMRMLSliceNode&);
522 
523  vtkSmartPointer<vtkMatrix4x4> SliceToRAS;
524 
525  vtkSmartPointer<vtkMatrix4x4> XYToSlice;
526  vtkSmartPointer<vtkMatrix4x4> XYToRAS;
527 
528  vtkSmartPointer<vtkMatrix4x4> UVWToSlice;
529  vtkSmartPointer<vtkMatrix4x4> UVWToRAS;
530 
531  typedef std::pair <std::string, vtkSmartPointer<vtkMatrix3x3> > OrientationPresetType;
532  std::vector< OrientationPresetType > OrientationMatrices;
533 
534  int JumpMode;
535 
541 
542  double FieldOfView[3];
543  double XYZOrigin[3];
544  double UVWOrigin[3];
545  int Dimensions[3];
546 
548  double UVWExtents[3];
549  int UVWDimensions[3];
550  int UVWMaximumDimensions[3];
551 
552  // Hold the string returned by GetOrientationString
553  std::string OrientationString;
554 
556 
558 
561 
563  double PrescribedSliceSpacing[3];
564 
566 
568  unsigned int InteractionFlags;
570 
572 
573  std::vector< std::string > ThreeDViewIDs;
574 };
575 
576 //----------------------------------------------------------------------------
577 std::vector< std::string > vtkMRMLSliceNode::GetThreeDViewIDs()const
578 {
579  return this->ThreeDViewIDs;
580 }
581 
582 #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 Reset(vtkMRMLNode *defaultNode) override
Reimplemented to preserve layout label when reset.
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:61
void ReadXMLAttributes(const char **atts) override
MRMLNode methods.
static const char * GetReformatOrientationName()
std::vector< OrientationPresetType > OrientationMatrices
MRML node for representing a volume (image stack).
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
vtkSmartPointer< vtkMatrix4x4 > XYToSlice
vtkMRMLCopyContentMacro(vtkMRMLAbstractViewNode)
void PrintSelf(ostream &os, vtkIndent indent) override
SliceResolutionModeType
Enum to specify the method for setting UVW extents.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
vtkSmartPointer< vtkMatrix4x4 > UVWToSlice
std::pair< std::string, vtkSmartPointer< vtkMatrix3x3 > > OrientationPresetType
void WriteXML(ostream &of, int indent) override
Write this node&#39;s information to a MRML file in XML format.
std::string OrientationString