Slicer  5.0
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 
101  void GetBrowserNodesForProxyNode(vtkMRMLNode* proxyNode, vtkCollection* foundBrowserNodes);
102 
106  vtkMRMLSequenceBrowserNode* GetFirstBrowserNodeForProxyNode(vtkMRMLNode* proxyNode);
107 
108 protected:
110  ~vtkSlicerSequencesLogic() override;
111 
112  void SetMRMLSceneInternal(vtkMRMLScene* newScene) override;
114  void RegisterNodes() override;
115  void UpdateFromMRMLScene() override;
116  void OnMRMLSceneNodeAdded(vtkMRMLNode* node) override;
117  void OnMRMLSceneNodeRemoved(vtkMRMLNode* node) override;
118  void ProcessMRMLNodesEvents(vtkObject *caller, unsigned long event, void *callData) override;
119 
120  bool IsDataConnectorNode(vtkMRMLNode*);
121 
122  // Time of the last update of each browser node (in universal time)
123  std::map< vtkMRMLSequenceBrowserNode*, double > LastSequenceBrowserUpdateTimeSec;
124 
125 private:
126 
127  bool UpdateProxyNodesFromSequencesInProgress{false};
128  bool UpdateSequencesFromProxyNodesInProgress{false};
129 
130  vtkSlicerSequencesLogic(const vtkSlicerSequencesLogic&); // Not implemented
131  void operator=(const vtkSlicerSequencesLogic&); // Not implemented
132 };
133 
134 #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:57
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!