Skip to content

Commit

Permalink
ENH: Restore removed RegisterIncomingMRMLNode function
Browse files Browse the repository at this point in the history
Some extensions still used the RegisterIncomingMRMLNode(vtkMRMLNode*) signature.
Restored so that those extensions can keep working.
  • Loading branch information
Sunderlandkyl committed May 3, 2021
1 parent 77ae07d commit 7f02269
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
39 changes: 38 additions & 1 deletion OpenIGTLinkIF/MRML/vtkMRMLIGTLConnectorNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ void vtkMRMLIGTLConnectorNode::vtkInternal::ProcessIncomingDeviceModifiedEvent(

this->IncomingNodeClientIDMap[modifiedNode->GetName()] = modifiedDevice->GetClientID();
modifiedNode->EndModify(wasModifyingNode);

if(isNewNodeCreated)
{
//New device event needs to be forward with the MRMLNode to other objects, such as openigtlinkRemote. where the node will be processed to set name accordingly.
Expand Down Expand Up @@ -1879,6 +1879,43 @@ void vtkMRMLIGTLConnectorNode::OnNodeReferenceModified(vtkMRMLNodeReference* ref
}
}

//---------------------------------------------------------------------------
bool vtkMRMLIGTLConnectorNode::RegisterIncomingMRMLNode(vtkMRMLNode* node)
{
if (!node)
{
vtkErrorMacro("Error registering incoming node. Incoming node is NULL");
return false;
}

if (!node->GetScene())
{
vtkErrorMacro("Error registering incoming node. Node scene is NULL");
return false;
}

igtlioDevicePointer device = NULL;
igtlioDeviceKeyType key;
key.name = node->GetName();
std::vector<std::string> deviceTypes = this->GetDeviceTypeFromMRMLNodeType(node->GetNodeTagName());
for (size_t typeIndex = 0; typeIndex < deviceTypes.size(); typeIndex++)
{
key.type = deviceTypes[typeIndex];
device = this->Internal->IOConnector->GetDevice(key);
if (device != NULL)
{
break;
}
}

if (device == NULL)
{
device = this->Internal->IOConnector->GetDeviceFactory()->create(key.type, key.name);
}

return this->RegisterIncomingMRMLNode(node, device);;
}

//---------------------------------------------------------------------------
bool vtkMRMLIGTLConnectorNode::RegisterIncomingMRMLNode(vtkMRMLNode* node, IGTLDevicePointer device)
{
Expand Down
1 change: 1 addition & 0 deletions OpenIGTLinkIF/MRML/vtkMRMLIGTLConnectorNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class VTK_SLICER_OPENIGTLINKIF_MODULE_MRML_EXPORT vtkMRMLIGTLConnectorNode : pub
// Description:
// Register MRML node for incoming data.
// Returns true on success.
bool RegisterIncomingMRMLNode(vtkMRMLNode* node);
bool RegisterIncomingMRMLNode(vtkMRMLNode* node, IGTLDevicePointer device);

// Description:
Expand Down

0 comments on commit 7f02269

Please sign in to comment.