Slicer  5.3
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) override;
47 
48 protected:
49 
51  ~vtkMRMLSliceLinkLogic() override;
52 
53  // On a change in scene, we need to manage the observations.
54  void SetMRMLSceneInternal(vtkMRMLScene * newScene) override;
55 
56  void OnMRMLSceneNodeAdded(vtkMRMLNode* node) override;
57  void OnMRMLSceneNodeRemoved(vtkMRMLNode* node) override;
58  void OnMRMLNodeModified(vtkMRMLNode* node) override;
59  void OnMRMLSceneStartBatchProcess() override;
60  void OnMRMLSceneEndBatchProcess() override;
61  void OnMRMLSceneStartImport() override;
62  void OnMRMLSceneEndImport() override;
63  void OnMRMLSceneStartRestore() override;
64  void OnMRMLSceneEndRestore() 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&) = delete;
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.
void PrintSelf(ostream &os, vtkIndent indent) override
virtual void OnMRMLSceneEndImport()
MRML node for storing a slice through RAS space.
MRML node for storing a slice through RAS space.
virtual void OnMRMLSceneStartImport()
virtual void OnMRMLSceneStartBatchProcess()
virtual void OnMRMLNodeModified(vtkMRMLNode *)
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
virtual void OnMRMLSceneNodeAdded(vtkMRMLNode *)
virtual void OnMRMLSceneEndBatchProcess()
virtual void OnMRMLSceneNodeRemoved(vtkMRMLNode *)
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
virtual void OnMRMLSceneEndRestore()
virtual void OnMRMLSceneStartRestore()
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
static vtkMRMLAbstractLogic * New()