Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkSlicerApplicationLogicRequests.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Copyright (c) Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5  See License.txt or http://www.slicer.org/copyright/copyright.txt for details.
6 
7 ==========================================================================*/
10 
11 #ifndef __vtkSlicerApplicationLogicRequests_h
12 #define __vtkSlicerApplicationLogicRequests_h
13 
14 #include <vtkMRMLDisplayNode.h>
17 #include <vtkMRMLModelNode.h>
18 #include <vtkMRMLStorageNode.h>
20 #include <vtkMRMLTableNode.h>
21 
22 //----------------------------------------------------------------------------
24 {
25 public:
27  {
28  m_UID = 0;
29  }
30 
31  DataRequest(int uid)
32  {
33  m_UID = uid;
34  }
35 
36  virtual ~DataRequest() = default;
37 
39 
40  int GetUID()const{return m_UID;}
41 
42 protected:
43  vtkMTimeType m_UID;
44 };
45 
46 //----------------------------------------------------------------------------
48 {
49 public:
50  ReadDataRequestFile(const std::string& node, const std::string& filename,
51  int displayData, int deleteFile, int uid = 0)
52  : DataRequest(uid)
53  {
54  m_TargetNode = node;
55  m_Filename = filename;
56  m_DisplayData = displayData;
57  m_DeleteFile = deleteFile;
58  }
59 
60  void Execute(vtkSlicerApplicationLogic* appLogic) override
61  {
62  // This method needs to read the data into the specific type of node and set up an
63  // appropriate storage and display node.
64 
65  vtkMRMLNode *nd = appLogic->GetMRMLScene()->GetNodeByID(m_TargetNode.c_str());
66  vtkDebugWithObjectMacro(appLogic, "ProcessReadNodeData: read data request node id = " << nd->GetID());
67 
68  vtkSmartPointer<vtkMRMLStorageNode> storageNode;
69 #ifdef Slicer_BUILD_CLI_SUPPORT
71 #endif
72 
73  bool useURI = appLogic->GetMRMLScene()->GetCacheManager()->IsRemoteReference(m_Filename.c_str());
74 
76  if (storableNode)
77  {
78  int numStorageNodes = storableNode->GetNumberOfStorageNodes();
79  for (int n = 0; n < numStorageNodes; n++)
80  {
81  vtkMRMLStorageNode *testStorageNode = storableNode->GetNthStorageNode(n);
82  if (testStorageNode)
83  {
84  if (useURI && testStorageNode->GetURI() != nullptr)
85  {
86  if (m_Filename.compare(testStorageNode->GetURI()) == 0)
87  {
88  // found a storage node for the remote file
89  vtkDebugWithObjectMacro(appLogic, "ProcessReadNodeData: found a storage node with the right URI: " << testStorageNode->GetURI());
90  storageNode = testStorageNode;
91  break;
92  }
93  }
94  else if (testStorageNode->GetFileName() != nullptr &&
95  m_Filename.compare(testStorageNode->GetFileName()) == 0)
96  {
97  // found the right storage node for a local file
98  vtkDebugWithObjectMacro(appLogic, "ProcessReadNodeData: found a storage node with the right filename: " << testStorageNode->GetFileName());
99  storageNode = testStorageNode;
100  break;
101  }
102  }
103  }
104 
105  // if there wasn't already a matching storage node on the node, make one
106  bool createdNewStorageNode = false;
107  if (storageNode.GetPointer() == nullptr)
108  {
109  // Read the data into the referenced node
110  if (itksys::SystemTools::FileExists(m_Filename.c_str()))
111  {
112  // file is there on disk
113  storableNode->AddDefaultStorageNode(m_Filename.c_str());
114  storageNode = storableNode->GetStorageNode();
115  createdNewStorageNode = (storageNode != nullptr);
116  }
117  }
118 
119  // Have the storage node read the data into the current node
120  if (storageNode.GetPointer() != nullptr)
121  {
122  try
123  {
124  vtkDebugWithObjectMacro(appLogic, "ProcessReadNodeData: about to call read data, " \
125  "storage node's read state is " << storageNode->GetReadStateAsString());
126  if (useURI)
127  {
128  storageNode->SetURI(m_Filename.c_str());
129  vtkDebugWithObjectMacro(appLogic, "ProcessReadNodeData: calling ReadData on the storage node " \
130  << storageNode->GetID() << ", uri = " << storageNode->GetURI());
131  storageNode->ReadData(nd, /*temporary*/true);
132  if (createdNewStorageNode)
133  {
134  storageNode->SetURI(nullptr); // clear temporary URI
135  }
136  }
137  else
138  {
139  storageNode->SetFileName(m_Filename.c_str());
140  vtkDebugWithObjectMacro(appLogic, "ProcessReadNodeData: calling ReadData on the storage node " \
141  << storageNode->GetID() << ", filename = " << storageNode->GetFileName());
142  storageNode->ReadData(nd, /*temporary*/true);
143  if (createdNewStorageNode)
144  {
145  storageNode->SetFileName(nullptr); // clear temp file name
146  }
147  }
148  }
149  catch (itk::ExceptionObject& exc)
150  {
151  vtkErrorWithObjectMacro(appLogic, "Exception while reading " << m_Filename << ", " << exc);
152  }
153  catch (...)
154  {
155  vtkErrorWithObjectMacro(appLogic, "Unknown exception while reading " << m_Filename);
156  }
157  }
158  }
159 #ifdef Slicer_BUILD_CLI_SUPPORT
160  // if the node was a CommandLineModule node, then read the file
161  // (no storage node for these, yet)
162  if (clp)
163  {
165  }
166 #endif
167 
168  // Delete the file if requested
169  if (m_DeleteFile)
170  {
171  int removed;
172  // is it a shared memory location?
173  if (m_Filename.find("slicer:") != std::string::npos)
174  {
175  removed = 1;
176  }
177  else
178  {
179  removed = static_cast<bool>(itksys::SystemTools::RemoveFile(m_Filename.c_str()));
180  }
181  if (!removed)
182  {
183  vtkGenericWarningMacro("Unable to delete temporary file " << m_Filename);
184  }
185  }
186 
187 
188  // Get the right type of display node. Only create a display node
189  // if one does not exist already
190  //
191  vtkMRMLDisplayableNode *displayableNode =
193  if (displayableNode)
194  {
195  // Create a default display node if no display node exists for the node yet.
196  displayableNode->CreateDefaultDisplayNodes();
197  }
198 
199  // Cause the any observers to fire (we may have avoided calling
200  // modified on the node)
201  //
202  nd->Modified();
203 
204  // If scalar volume, set the volume as the active volume and
205  // propagate selection.
206  //
207  // Models are always displayed when loaded above.
208  //
209  // Tensors? Vectors?
210  if (m_DisplayData)
211  {
212  if (vtkMRMLLabelMapVolumeNode::SafeDownCast(nd) != nullptr)
213  {
215  appLogic->PropagateVolumeSelection();
216  }
217  else if (vtkMRMLScalarVolumeNode::SafeDownCast(nd) != nullptr)
218  {
219  appLogic->GetSelectionNode()->SetActiveVolumeID(m_TargetNode.c_str());
220  // make sure win/level gets calculated
222  if (displayNode)
223  {
224  displayNode->Modified();
225  }
226  appLogic->PropagateVolumeSelection();
227  }
228  else if (vtkMRMLTableNode::SafeDownCast(nd) != nullptr)
229  {
230  appLogic->GetSelectionNode()->SetActiveTableID(m_TargetNode.c_str());
231  appLogic->PropagateTableSelection();
232  }
233  }
234  }
235 
236 protected:
237  std::string m_TargetNode;
238  std::string m_Filename;
241 };
242 
243 //----------------------------------------------------------------------------
245 {
246 public:
247  ReadDataRequestScene(const std::vector<std::string>& targetNodes,
248  const std::vector<std::string>& sourceNodes,
249  const std::string& filename,
250  int displayData, int deleteFile,
251  int uid = 0)
252  : DataRequest(uid)
253  {
254  m_TargetNodes = targetNodes;
255  m_SourceNodes = sourceNodes;
256  m_Filename = filename;
257  m_DisplayData = displayData;
258  m_DeleteFile = deleteFile;
259  }
260 
261  void Execute(vtkSlicerApplicationLogic* appLogic) override
262  {
263  if (m_SourceNodes.size() != m_TargetNodes.size())
264  {
265  // Can't do ID remapping if the two node lists are different
266  // sizes. Just import the scene. (This is where we would put to
267  // the code to load into a node hierarchy (with a corresponding
268  // change in the conditional above)).
269  appLogic->GetMRMLScene()->SetURL(m_Filename.c_str());
270  appLogic->GetMRMLScene()->Import();
271 
272  // Delete the file if requested
273  if (m_DeleteFile)
274  {
275  int removed;
276  removed = static_cast<bool>(itksys::SystemTools::RemoveFile(m_Filename.c_str()));
277  if (!removed)
278  {
279  std::stringstream information;
280  information << "Unable to delete temporary file "
281  << m_Filename << std::endl;
282  vtkGenericWarningMacro( << information.str().c_str() );
283  }
284  }
285 
286  return;
287  }
288 
289  vtkNew<vtkMRMLScene> miniscene;
290  miniscene->SetURL(m_Filename.c_str() );
291  miniscene->Import();
292 
293  // iterate over the list of nodes specified to read
294  std::vector<std::string>::const_iterator tit;
295  std::vector<std::string>::const_iterator sit;
296 
297  tit = m_TargetNodes.begin();
298  sit = m_SourceNodes.begin();
299 
301 
302  while (sit != m_SourceNodes.end())
303  {
304  vtkMRMLNode *source = miniscene->GetNodeByID(sit->c_str());
305  vtkMRMLNode *target = appLogic->GetMRMLScene()->GetNodeByID( tit->c_str() );
306 
307  if (source && target)
308  {
309  // save old storage info (in case user has custom file name already
310  // defined for this node, don't use the one from the miniscene since it
311  // was only used to read/write the temp area).
312  vtkMRMLStorableNode *storableTarget = vtkMRMLStorableNode::SafeDownCast(target);
313  if ( storableTarget )
314  {
315  const char *oldStorageNodeID = storableTarget->GetStorageNodeID();
316  target->Copy(source);
317  storableTarget->SetAndObserveStorageNodeID(oldStorageNodeID);
318  }
319  else
320  {
321  target->Copy(source);
322  }
323 
324  // if the source node is a model hierarchy node, then also copy
325  // and remap any child nodes of the target that are not in the
326  // target list (nodes that had no source equivalent before the
327  // module ran).
332  if (smhnd && tmhnd)
333  {
334  // get the model node and display node BEFORE we add nodes to
335  // the target scene
336  vtkMRMLModelNode *smnd = smhnd->GetModelNode();
337  vtkMRMLDisplayNode *sdnd = smhnd->GetDisplayNode();
338 
339  // add the model and display referenced by source model hierarchy node
340  if (smnd)
341  {
342  // set the model node to be modified, as it was read from a temp
343  // location
344  //smnd->SetModifiedSinceRead(1);
345  // get display node BEFORE we add nodes to the target scene
346  vtkMRMLDisplayNode *sdnd1 = smnd->GetDisplayNode();
347 
348  vtkMRMLNode *tmodel = appLogic->GetMRMLScene()->CopyNode(smnd);
351  tmhnd->SetModelNodeID( mnd->GetID() );
352 
353  if (sdnd1)
354  {
355  vtkMRMLNode *tdnd = appLogic->GetMRMLScene()->CopyNode(sdnd1);
356  mnd->SetAndObserveDisplayNodeID( tdnd->GetID() );
357  }
358  }
359 
360  if (sdnd)
361  {
362  vtkMRMLNode *dnd = appLogic->GetMRMLScene()->CopyNode(sdnd);
363  tmhnd->SetAndObserveDisplayNodeID( dnd->GetID() );
364  }
365 
366  // add any children model hierarchy nodes, rinse, repeat
367  //
368  // keep a map of model hierarchy node ids so that can update the parent node references
369  std::map<std::string, std::string> parentNodeIDMapper;
370  // hopefully the parents will have been read first, but if not
371  // keep a list of model hierarchy nodes that failed to have their parent node reference remapped
372  std::vector<vtkMRMLModelHierarchyNode *> childNodesThatNeedParentsIDsRemapped;
373  for (int n=0;
374  n<miniscene->GetNumberOfNodesByClass("vtkMRMLModelHierarchyNode");
375  n++)
376  {
378  ::SafeDownCast(miniscene->GetNthNodeByClass(n,
379  "vtkMRMLModelHierarchyNode"));
380  if (mhnd)
381  {
382  // is this model hierarchy node in our source list
383  // already? if so skip it
384  std::vector<std::string>::const_iterator ssit
385  = std::find(m_SourceNodes.begin(),
386  m_SourceNodes.end(), mhnd->GetID());
387  if (ssit == m_SourceNodes.end())
388  {
389  // not in source list, so we may need to add it,
390  // if it's a child, grandchild etc of the top level node that we're importing
391  if (strcmp(mhnd->GetTopParentNode()->GetID(), smhnd->GetID()) == 0)
392  {
393  // get the model and display node BEFORE we add nodes
394  // to the target scene
395  vtkMRMLModelNode *smnd1 = mhnd->GetModelNode();
396  vtkMRMLDisplayNode *sdnd1 = mhnd->GetDisplayNode();
397 
398  vtkMRMLNode *tchild = appLogic->GetMRMLScene()->CopyNode(mhnd);
399  // keep track of any node id change in case other nodes use this as a parent
400  parentNodeIDMapper[std::string(mhnd->GetID())] = std::string(tchild->GetID());
403  // check for a parent node id in the mapper (as long as it doesn't already
404  // point to the source node), default to the top level one though
405  std::string parentNodeID = std::string(tmhnd->GetID());
406  if (tcmhd->GetParentNodeID() != nullptr &&
407  strcmp(tcmhd->GetParentNodeID(),smhnd->GetID()) != 0)
408  {
409  std::map<std::string,std::string>::iterator pIt = parentNodeIDMapper.find(std::string(tcmhd->GetParentNodeID()));
410  if (pIt != parentNodeIDMapper.end())
411  {
412  parentNodeID = pIt->second;
413  vtkDebugWithObjectMacro(appLogic, "Remapped parent node id to " << parentNodeID.c_str());
414  }
415  else
416  {
417  childNodesThatNeedParentsIDsRemapped.push_back(tcmhd);
418  }
419  }
420  tcmhd->SetParentNodeID( parentNodeID.c_str() );
421 
422  if (smnd1)
423  {
424  // set it as modified
425  //smnd1->SetModifiedSinceRead(1);
426  // get display node BEFORE we add nodes to the target scene
427  vtkMRMLDisplayNode *sdnd2 = smnd1->GetDisplayNode();
428 
429  vtkMRMLNode *tmodel = appLogic->GetMRMLScene()->CopyNode(smnd1);
432  tcmhd->SetModelNodeID( mnd->GetID() );
433 
434  if (sdnd2)
435  {
436  vtkMRMLNode *tdnd = appLogic->GetMRMLScene()->CopyNode(sdnd2);
437  mnd->SetAndObserveDisplayNodeID( tdnd->GetID() );
438  }
439  }
440 
441  if (sdnd1)
442  {
443  vtkMRMLNode *tdnd = appLogic->GetMRMLScene()->CopyNode(sdnd1);
444  tcmhd->SetAndObserveDisplayNodeID( tdnd->GetID() );
445  }
446  }
447  }
448  }
449  }
450  if (childNodesThatNeedParentsIDsRemapped.size() > 0)
451  {
452  // iterate through all the imported hierarchies that failed and double check their parent node ids
453  for (unsigned int i = 0; i < childNodesThatNeedParentsIDsRemapped.size(); i++)
454  {
455  std::map<std::string,std::string>::iterator pIt = parentNodeIDMapper.find(childNodesThatNeedParentsIDsRemapped[i]->GetParentNodeID());
456  if (pIt != parentNodeIDMapper.end())
457  {
458  vtkDebugWithObjectMacro(appLogic, "Remapping child node " << childNodesThatNeedParentsIDsRemapped[i]->GetName() << \
459  " parent node id from " << childNodesThatNeedParentsIDsRemapped[i]->GetParentNodeID() << " to " << pIt->second.c_str());
460  childNodesThatNeedParentsIDsRemapped[i]->SetParentNodeID(pIt->second.c_str());
461  }
462  }
463  }
464  }
465  }
466  else if (!source)
467  {
468  std::stringstream information;
469  information << "Node " << (*sit) << " not found in scene file "
470  << m_Filename << std::endl;
471  vtkGenericWarningMacro( << information.str().c_str() );
472  }
473  else if (!target)
474  {
475  std::stringstream information;
476  information << "Node " << (*tit) << " not found in current scene."
477  << std::endl;
478  vtkGenericWarningMacro( << information.str().c_str() );
479  }
480 
481  ++sit;
482  ++tit;
483  }
484 
486 
487  // Delete the file if requested
488  if (m_DeleteFile)
489  {
490  int removed;
491  removed = static_cast<bool>(itksys::SystemTools::RemoveFile( m_Filename.c_str() ));
492  if (!removed)
493  {
494  std::stringstream information;
495  information << "Unable to delete temporary file "
496  << m_Filename << std::endl;
497  vtkGenericWarningMacro( << information.str().c_str() );
498  }
499  }
500  }
501 
502 protected:
503  std::vector<std::string> m_TargetNodes;
504  std::vector<std::string> m_SourceNodes;
505  std::string m_Filename;
508 };
509 
510 //----------------------------------------------------------------------------
512 {
513 public:
514  ReadDataRequestUpdateParentTransform(const std::string& updatedNode,
515  const std::string& parentTransformNode, int uid = 0)
516  : DataRequest(uid)
517  {
518  m_UpdatedNode = updatedNode;
519  m_ParentTransformNode = parentTransformNode;
520  }
521 
522  void Execute(vtkSlicerApplicationLogic* appLogic) override
523  {
524  vtkMRMLScene* scene = appLogic->GetMRMLScene();
526  scene->GetNodeByID(m_UpdatedNode));
527  if (node)
528  {
530  }
531  }
532 
533 protected:
534  std::string m_UpdatedNode;
536 };
537 
538 //----------------------------------------------------------------------------
540 {
541 public:
542  ReadDataRequestUpdateSubjectHierarchyLocation(const std::string& updatedNode,
543  const std::string& siblingNode, int uid = 0)
544  : DataRequest(uid)
545  {
546  m_UpdatedNode = updatedNode;
547  m_SubjectHierarchySiblingNode = siblingNode;
548  }
549 
550  void Execute(vtkSlicerApplicationLogic* appLogic) override
551  {
552  vtkMRMLScene* scene = appLogic->GetMRMLScene();
553 
555  vtkMRMLNode *updatedNode = scene->GetNodeByID(m_UpdatedNode);
557  vtkIdType siblingNodeShItemID = shnd->GetItemByDataNode(siblingNode);
558  vtkIdType updatedNodeShItemID = shnd->GetItemByDataNode(updatedNode);
559 
560  if (updatedNodeShItemID && siblingNodeShItemID)
561  {
562  vtkIdType parentItemID = shnd->GetItemParent(siblingNodeShItemID);
563  shnd->SetItemParent(updatedNodeShItemID, parentItemID);
564  shnd->SetItemLevel(updatedNodeShItemID, shnd->GetItemLevel(siblingNodeShItemID));
565  }
566  }
567 
568 protected:
569  std::string m_UpdatedNode;
571 };
572 
573 //----------------------------------------------------------------------------
575 {
576 public:
577  ReadDataRequestAddNodeReference(const std::string& referencingNode,
578  const std::string& referencedNode, const std::string& role, int uid = 0)
579  : DataRequest(uid)
580  {
581  m_ReferencingNode = referencingNode;
582  m_ReferencedNode = referencedNode;
583  m_Role = role;
584  }
585 
586  void Execute(vtkSlicerApplicationLogic* appLogic) override
587  {
588  vtkMRMLScene* scene = appLogic->GetMRMLScene();
589 
590  vtkMRMLNode *referencingNode = scene->GetNodeByID(m_ReferencingNode);
591  vtkMRMLNode *referencedNode = scene->GetNodeByID(m_ReferencedNode);
592  if (referencingNode && referencedNode)
593  {
594  referencingNode->AddNodeReferenceID(m_Role.c_str(), m_ReferencedNode.c_str());
595  }
596  }
597 
598 protected:
599  std::string m_ReferencingNode;
600  std::string m_ReferencedNode;
601  std::string m_Role;
602 };
603 
604 //----------------------------------------------------------------------------
606 {
607 public:
609  const std::string& vtkNotUsed(node),
610  const std::string& vtkNotUsed(filename),
611  int uid = 0)
612  : DataRequest(uid)
613  {
614  }
615 protected:
616  std::string m_SourceNode;
617  std::string m_Filename;
618 };
619 
620 //----------------------------------------------------------------------------
622 {
623 public:
624  WriteDataRequestScene(const std::vector<std::string>& targetNodes,
625  const std::vector<std::string>& sourceNodes,
626  const std::string& filename,
627  int uid = 0)
628  : DataRequest(uid)
629  {
630  m_TargetNodes = targetNodes;
631  m_SourceNodes = sourceNodes;
632  m_Filename = filename;
633  }
634 
635  void Execute(vtkSlicerApplicationLogic* appLogic) override
636  {
637  if (m_SourceNodes.size() != m_TargetNodes.size())
638  {
639  // Can't do ID remapping if the two node lists are different
640  // sizes. Just commit the scene. (This is where we would put to
641  // the code to load into a node hierarchy (with a corresponding
642  // change in the conditional above)).
643  appLogic->GetMRMLScene()->SetURL( m_Filename.c_str() );
644  appLogic->GetMRMLScene()->Commit();
645  return;
646  }
647  }
648 
649 protected:
650  std::vector<std::string> m_TargetNodes;
651  std::vector<std::string> m_SourceNodes;
652  std::string m_Filename;
653 };
654 
655 
656 #endif // __vtkSlicerApplicationLogicRequests_h
void Execute(vtkSlicerApplicationLogic *appLogic) override
void Execute(vtkSlicerApplicationLogic *appLogic) override
void SetActiveVolumeID(const char *id)
void Execute(vtkSlicerApplicationLogic *appLogic) override
void EndState(unsigned long state)
Unflag the scene as being in a state mode.
ReadDataRequestUpdateSubjectHierarchyLocation(const std::string &updatedNode, const std::string &siblingNode, int uid=0)
void SetAndObserveDisplayNodeID(const char *displayNodeID)
vtkMRMLStorageNode * GetNthStorageNode(int n)
Get associated display MRML node
vtkMRMLHierarchyNode * GetTopParentNode()
Get the top parent node in the hierarchy
void Execute(vtkSlicerApplicationLogic *appLogic) override
bool SetAndObserveTransformNodeID(const char *transformNodeID)
virtual ~DataRequest()=default
MRML node to represent a 3D surface model.
void SetItemLevel(vtkIdType itemID, std::string level)
Convenience function to set level attribute for a subject hierarchy item.
WriteDataRequestScene(const std::vector< std::string > &targetNodes, const std::vector< std::string > &sourceNodes, const std::string &filename, int uid=0)
vtkMRMLSelectionNode * GetSelectionNode() const
Get default Selection node.
virtual char * GetURI()
vtkMRMLScene * GetMRMLScene() const
Return a reference to the current MRML scene.
void Execute(vtkSlicerApplicationLogic *appLogic) override
vtkMRMLNode * CopyNode(vtkMRMLNode *n)
Add a copy of a node to the scene.
std::vector< std::string > m_SourceNodes
WriteDataRequestFile(const std::string &vtkNotUsed(node), const std::string &vtkNotUsed(filename), int uid=0)
void SetAndObserveDisplayNodeID(const char *DisplayNodeID)
MRML node to represent a complete subject hierarchy tree.
static vtkMRMLModelHierarchyNode * SafeDownCast(vtkObject *o)
void PropagateVolumeSelection(int fit=1)
static vtkMRMLCommandLineModuleNode * SafeDownCast(vtkObject *o)
ReadDataRequestAddNodeReference(const std::string &referencingNode, const std::string &referencedNode, const std::string &role, int uid=0)
void SetActiveLabelVolumeID(const char *id)
const char * GetStorageNodeID()
vtkMRMLDisplayNode * GetDisplayNode()
Get associated display MRML node
virtual bool AddDefaultStorageNode(const char *filename=nullptr)
virtual void Copy(vtkMRMLNode *node)
Copy node contents from another node of the same type. Does not copy node ID and Scene. Performs deep copy - an independent copy is created from all data, including bulk data.
MRML node to represent a 3D surface model.
void SetAndObserveStorageNodeID(const char *storageNodeID)
String ID of the storage MRML node
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
virtual char * GetID()
ID use by other nodes to reference this node in XML.
vtkMRMLNode * AddNodeReferenceID(const char *referenceRole, const char *referencedNodeID)
Convenience method that adds a referencedNodeID at the end of the list.
std::vector< std::string > m_SourceNodes
virtual char * GetFileName()
int Commit(const char *url=nullptr, vtkMRMLMessageCollection *userMessages=nullptr)
ReadDataRequestUpdateParentTransform(const std::string &updatedNode, const std::string &parentTransformNode, int uid=0)
static vtkMRMLLabelMapVolumeNode * SafeDownCast(vtkObject *o)
static vtkMRMLSubjectHierarchyNode * GetSubjectHierarchyNode(vtkMRMLScene *scene)
virtual void CreateDefaultDisplayNodes()
void StartState(unsigned long state, int anticipatedMaxProgress=0)
Flag the scene as being in a state mode.
void PropagateTableSelection()
Propagate selected table in the SelectionNode to table view nodes.
virtual vtkCacheManager * GetCacheManager()
std::vector< std::string > m_TargetNodes
vtkMRMLNode * GetNodeByID(const char *name)
Get node given a unique ID.
vtkMRMLDisplayNode * GetDisplayNode()
static vtkMRMLStorableNode * SafeDownCast(vtkObject *o)
std::string GetItemLevel(vtkIdType itemID)
Convenience function to get level attribute for a subject hierarchy item.
A superclass for other storage nodes.
void SetModelNodeID(const char *id)
String ID of the model MRML node
MRML node to represent a hierarchyu of models.
static vtkMRMLTableNode * SafeDownCast(vtkObject *o)
vtkMRMLModelNode * GetModelNode()
Get associated model MRML node
int Import(vtkMRMLMessageCollection *userMessages=nullptr)
Add the scene into the existing scene (no clear) from URL file or from.
void SetURL(const char *url)
Set URL (file name) of the scene.
virtual int IsRemoteReference(const char *uri)
vtkIdType GetItemByDataNode(vtkMRMLNode *dataNode)
vtkMRMLStorageNode * GetStorageNode()
static vtkMRMLScalarVolumeNode * SafeDownCast(vtkObject *o)
void SetItemParent(vtkIdType itemID, vtkIdType parentItemID, bool enableCircularCheck=true)
bool ReadParameterFile(const std::string &filename)
static vtkMRMLDisplayableNode * SafeDownCast(vtkObject *o)
virtual void SetURI(const char *)
Location of the remote copy of this file.
Abstract class that contains graphical display properties for displayable nodes.
void Modified() override
Customized version of Modified() allowing to compress vtkCommand::ModifiedEvent.
Definition: vtkMRMLNode.h:515
void SetActiveTableID(const char *id)
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
MRML node for representing the parameters allowing to run a command line interface module (CLI)...
ReadDataRequestScene(const std::vector< std::string > &targetNodes, const std::vector< std::string > &sourceNodes, const std::string &filename, int displayData, int deleteFile, int uid=0)
vtkIdType GetItemParent(vtkIdType itemID)
std::vector< std::string > m_TargetNodes
static vtkMRMLTransformableNode * SafeDownCast(vtkObject *o)
static vtkMRMLModelNode * SafeDownCast(vtkObject *o)
MRML node for representing a node with a transform.
void Execute(vtkSlicerApplicationLogic *appLogic) override
ReadDataRequestFile(const std::string &node, const std::string &filename, int displayData, int deleteFile, int uid=0)
virtual void Execute(vtkSlicerApplicationLogic *)