Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkSlicerSequencesLogic.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Portions (c) Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16 ==============================================================================*/
17 
18 // .NAME vtkSlicerSequencesLogic - slicer logic class for volumes manipulation
19 // .SECTION Description
20 // This class manages the logic associated with reading, saving,
21 // and changing propertied of the volumes
22 
23 
24 #ifndef __vtkSlicerSequencesLogic_h
25 #define __vtkSlicerSequencesLogic_h
26 
27 // Slicer includes
28 #include "vtkSlicerModuleLogic.h"
29 
30 // MRML includes
31 
32 // STD includes
33 #include <cstdlib>
34 
35 #include "vtkSlicerSequencesModuleLogicExport.h"
36 
38 class vtkMRMLNode;
41 
43 class VTK_SLICER_SEQUENCES_MODULE_LOGIC_EXPORT vtkSlicerSequencesLogic :
45 {
46 public:
47 
48  static vtkSlicerSequencesLogic *New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
58  vtkMRMLSequenceNode* AddSequence(const char* filename, vtkMRMLMessageCollection* userMessages=nullptr);
59 
61  void UpdateAllProxyNodes();
62 
64  void UpdateProxyNodesFromSequences(vtkMRMLSequenceBrowserNode* browserNode);
65 
67  void UpdateSequencesFromProxyNodes(vtkMRMLSequenceBrowserNode* browserNode, vtkMRMLNode* proxyNode);
68 
71  {
72  static bool warningLogged = false;
73  if (!warningLogged)
74  {
75  vtkWarningMacro("vtkSlicerSequenceBrowserLogic::UpdateVirtualOutputNodes is deprecated,"
76  << " use vtkSlicerSequenceBrowserLogic::UpdateProxyNodes method instead");
77  warningLogged = true;
78  }
79  this->UpdateProxyNodesFromSequences(browserNode);
80  }
81 
86  vtkMRMLSequenceNode* AddSynchronizedNode(vtkMRMLNode* sequenceNode, vtkMRMLNode* proxyNode, vtkMRMLNode* browserNode);
87 
88  void GetCompatibleNodesFromScene(vtkCollection* compatibleNodes, vtkMRMLSequenceNode* sequenceNode);
89 
90  static bool IsNodeCompatibleForBrowsing(vtkMRMLSequenceNode* masterNode, vtkMRMLSequenceNode* testedNode);
91 
93  void GetBrowserNodesForSequenceNode(vtkMRMLSequenceNode* sequenceNode, vtkCollection* foundBrowserNodes);
94 
98  vtkMRMLSequenceBrowserNode* GetFirstBrowserNodeForSequenceNode(vtkMRMLSequenceNode* sequenceNode);
99 
100 protected:
102  ~vtkSlicerSequencesLogic() override;
103 
104  void SetMRMLSceneInternal(vtkMRMLScene* newScene) override;
106  void RegisterNodes() override;
107  void UpdateFromMRMLScene() override;
108  void OnMRMLSceneNodeAdded(vtkMRMLNode* node) override;
109  void OnMRMLSceneNodeRemoved(vtkMRMLNode* node) override;
110  void ProcessMRMLNodesEvents(vtkObject *caller, unsigned long event, void *callData) override;
111 
112  bool IsDataConnectorNode(vtkMRMLNode*);
113 
114  // Time of the last update of each browser node (in universal time)
115  std::map< vtkMRMLSequenceBrowserNode*, double > LastSequenceBrowserUpdateTimeSec;
116 
117 private:
118 
119  bool UpdateProxyNodesFromSequencesInProgress{false};
120  bool UpdateSequencesFromProxyNodesInProgress{false};
121 
122  vtkSlicerSequencesLogic(const vtkSlicerSequencesLogic&); // Not implemented
123  void operator=(const vtkSlicerSequencesLogic&); // Not implemented
124 };
125 
126 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
static vtkSlicerModuleLogic * New()
The Usual vtk class functions.
MRML node for representing a sequence of MRML nodes.
virtual void ProcessMRMLNodesEvents(vtkObject *caller, unsigned long event, void *callData)
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:61
virtual void OnMRMLSceneNodeAdded(vtkMRMLNode *)
virtual void OnMRMLSceneNodeRemoved(vtkMRMLNode *)
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
std::map< vtkMRMLSequenceBrowserNode *, double > LastSequenceBrowserUpdateTimeSec
virtual void UpdateFromMRMLScene()
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
void UpdateVirtualOutputNodes(vtkMRMLSequenceBrowserNode *browserNode)
Deprecated method!