Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLSliceLinkLogic.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: vtkMRMLSliceLinkLogic.h,v $
10  Date: $Date$
11  Version: $Revision$
12 
13 =========================================================================auto=*/
14 
26 
27 #ifndef __vtkMRMLSliceLinkLogic_h
28 #define __vtkMRMLSliceLinkLogic_h
29 
30 // MRMLLogic includes
31 #include "vtkMRMLAbstractLogic.h"
32 
33 // STD includes
34 #include <vector>
35 
36 class vtkMRMLSliceNode;
38 
39 class VTK_MRML_LOGIC_EXPORT vtkMRMLSliceLinkLogic : public vtkMRMLAbstractLogic
40 {
41 public:
42 
44  static vtkMRMLSliceLinkLogic *New();
46  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
47 
48 protected:
49 
51  virtual ~vtkMRMLSliceLinkLogic();
52 
53  // On a change in scene, we need to manage the observations.
54  virtual void SetMRMLSceneInternal(vtkMRMLScene * newScene) VTK_OVERRIDE;
55 
56  virtual void OnMRMLSceneNodeAdded(vtkMRMLNode* node) VTK_OVERRIDE;
57  virtual void OnMRMLSceneNodeRemoved(vtkMRMLNode* node) VTK_OVERRIDE;
58  virtual void OnMRMLNodeModified(vtkMRMLNode* node) VTK_OVERRIDE;
59  virtual void OnMRMLSceneStartBatchProcess() VTK_OVERRIDE;
60  virtual void OnMRMLSceneEndBatchProcess() VTK_OVERRIDE;
61  virtual void OnMRMLSceneStartImport() VTK_OVERRIDE;
62  virtual void OnMRMLSceneEndImport() VTK_OVERRIDE;
63  virtual void OnMRMLSceneStartRestore() VTK_OVERRIDE;
64  virtual void OnMRMLSceneEndRestore() VTK_OVERRIDE;
65 
66  // Used internally to control whether we are in the process of
67  // broadcasting events. PIMPL it?
68  void BroadcastingEventsOn();
69  void BroadcastingEventsOff();
70  int GetBroadcastingEvents();
71 
73  void BroadcastSliceNodeEvent(vtkMRMLSliceNode *sliceNode);
74 
76  void BroadcastSliceCompositeNodeEvent(vtkMRMLSliceCompositeNode *compositeNode);
77 
79  bool IsOrientationMatching(vtkMRMLSliceNode *sliceNode1, vtkMRMLSliceNode *sliceNode2, double comparisonTolerance = 0.001);
80 
81 private:
82 
84  void operator=(const vtkMRMLSliceLinkLogic&);
85 
86  vtkMRMLSliceCompositeNode* GetCompositeNode(vtkMRMLSliceNode*);
87  void BroadcastLastRotation(vtkMRMLSliceNode*, vtkMRMLSliceNode*);
88  void UpdateSliceNodeInteractionStatus(vtkMRMLSliceNode*);
89 
90  // Counter on nested requests for Broadcasting events. Counter is
91  // used as scene restores and scene view restores issue several
92  // nested events and we want to block from the first Start to the
93  // last End event (StartBatchProcess, StartImport, StartRestore).
94  int BroadcastingEvents;
95 
96  struct SliceNodeInfos
97  {
98  SliceNodeInfos(int interacting) : Interacting(interacting) {}
99  double LastNormal[3];
100  int Interacting;
101  };
102 
103  typedef std::map<std::string, SliceNodeInfos> SliceNodeStatusMap;
104  SliceNodeStatusMap SliceNodeInteractionStatus;
105 
106 };
107 
108 #endif
Superclass for MRML logic classes.
MRML node for storing a slice through RAS space.
MRML node for storing a slice through RAS space.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual void OnMRMLSceneStartBatchProcess()
virtual void OnMRMLNodeModified(vtkMRMLNode *)
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
virtual void OnMRMLSceneNodeAdded(vtkMRMLNode *)
virtual void OnMRMLSceneNodeRemoved(vtkMRMLNode *)
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
static vtkMRMLAbstractLogic * New()