-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Omni support #106
Open
LauraConnolly
wants to merge
36
commits into
openigtlink:master
Choose a base branch
from
LauraConnolly:OmniSupport
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Omni support #106
Changes from 6 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
d8fc9a0
Added support for incoming omni messages.
LauraConnolly 588c7c7
Working on adding support for vtkMRMLIGTLTableNode
LauraConnolly 3efdf4e
Made changes for vtkDataArray declaration
LauraConnolly e4df47e
Changes in July.
LauraConnolly b341e36
Most recent changes.
LauraConnolly 0ac835d
Fixed how nd array messages are added to vtkmrml table NodeInfoMapType
LauraConnolly ddccacd
ENH: Remove unnecessary find_package(Slicer)
Sunderlandkyl 238e99c
BUG: Fix typo in MRML std::string vector copy macro
Sunderlandkyl ac6473d
COMP: Restore backwards compatibility with Slicer 4.10.2
Sunderlandkyl b37b2bb
COMP: Fix bundling of OpenIGTLinkIO external project adding VTK depen…
jcfr 019e449
ENH: Add support for transferring markups fiducial node as POINT message
lassoan 8b75cac
BUG: Fix typo in OpenIGTLink message metadata MEMLNodeName -> MRMLNod…
lassoan 913c303
COMP: Fix build error on macOS
lassoan aec89b0
ENH: Ensure correct spacing and origin when receiving an igtl Image m…
adamrankin 34b4c61
ENH: Add launcher paths for bundling into custom app
sjh26 a446059
Bug: Query node device name fix.
leochan2009 07810f3
Revert "Bug: Query node device name fix."
leochan2009 b01c782
Feature: backward compatiblity. legacy program can send data without …
leochan2009 618b625
BUG: forward the mrml node when new device added. Improvement: remove…
leochan2009 d822610
Improvement: use a OriginalNodeName attribute to store the original n…
leochan2009 c31e970
BUG:label map name empty. LabelVolume is never created by openigtlin…
leochan2009 e705412
ENH: Restore removed RegisterIncomingMRMLNode function
Sunderlandkyl 1435ec9
ENH: Add base class for scripted ultrasound parameter widgets
Sunderlandkyl a64e0b3
BUG: Fix crash when OriginalNodeName attribute is not defined
Sunderlandkyl 83fa3b2
ENH: Add missing igtlioCommand methods to vtkSlicerOpenIGTLinkCommand
Sunderlandkyl c94ab05
BUG: Instantiate nodes using default scene parameters
Sunderlandkyl 8c95b64
ENH: Update PeriodicProcess to use SlicerRenderBlocker
Sunderlandkyl 5837a53
COMP: Remove text node so that extension builds in custom app
cpinter 68c6d67
ENH: Add an UltrasoundRemoteControl widget for controlling TGC
markasselin 8454084
COMP: Fix subproject configuration if Python was installed
cpinter 3369407
ENH: Add support for Markups ROI for reconstructed volume rendering
Sunderlandkyl 8fbb196
Added support for incoming omni messages.
LauraConnolly 136c924
Working on adding support for vtkMRMLIGTLTableNode
LauraConnolly 693ed9d
Made changes for vtkDataArray declaration
LauraConnolly 0f17a37
Most recent changes.
LauraConnolly 7836fa3
vtkMRMLIGTLConnectorNode code is up to date now - so it OpenIGTLinkIO…
LauraConnolly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
/*=auto========================================================================= | ||
|
||
Portions (c) Copyright 2009 Brigham and Women's Hospital (BWH) All Rights Reserved. | ||
|
||
See Doc/copyright/copyright.txt | ||
or http://www.slicer.org/copyright/copyright.txt for details. | ||
|
||
Program: 3D Slicer | ||
Module: $RCSfile: vtkMRMLConnectorNode.cxx,v $ | ||
Date: $Date: 2006/03/17 15:10:10 $ | ||
Version: $Revision: 1.2 $ | ||
|
||
=========================================================================auto=*/ | ||
|
||
// OpenIGTLink includes | ||
|
@@ -24,6 +20,7 @@ Version: $Revision: 1.2 $ | |
#include <igtlioLabelMetaDevice.h> | ||
#include <igtlioPolyDataDevice.h> | ||
#include <igtlioPointDevice.h> | ||
#include <igtlioNDArrayDevice.h> | ||
#include <igtlioStatusDevice.h> | ||
#include <igtlioStringDevice.h> | ||
#include <igtlioTransformDevice.h> | ||
|
@@ -35,6 +32,7 @@ Version: $Revision: 1.2 $ | |
// OpenIGTLinkIF MRML includes | ||
#include "vtkMRMLIGTLConnectorNode.h" | ||
#include "vtkMRMLIGTLStatusNode.h" | ||
#include "vtkMRMLTableNode.h" | ||
#include "vtkMRMLImageMetaListNode.h" | ||
#include "vtkMRMLLabelMetaListNode.h" | ||
#include "vtkMRMLTextNode.h" | ||
|
@@ -44,6 +42,7 @@ Version: $Revision: 1.2 $ | |
// MRML includes | ||
#include <vtkMRMLColorLogic.h> | ||
#include <vtkMRMLColorTableNode.h> | ||
#include <vtkMRMLTableNode.h> | ||
#include <vtkMRMLLinearTransformNode.h> | ||
#include <vtkMRMLModelNode.h> | ||
#include <vtkMRMLScalarVolumeDisplayNode.h> | ||
|
@@ -52,15 +51,22 @@ Version: $Revision: 1.2 $ | |
#include <vtkMRMLVectorVolumeDisplayNode.h> | ||
#include <vtkMRMLVectorVolumeNode.h> | ||
#include <vtkMRMLVolumeNode.h> | ||
#include <vtkMRMLTableNode.h> | ||
|
||
// VTK includes | ||
#include <vtkCollection.h> | ||
#include <vtkImageData.h> | ||
#include <vtkMatrix4x4.h> | ||
#include <vtkMutexLock.h> | ||
#include <vtkPolyData.h> | ||
#include <vtkTable.h> | ||
#include <vtkTable.h> | ||
#include <vtkTimerLog.h> | ||
#include <vtkWeakPointer.h> | ||
#include <vtkDataArray.h> | ||
#include <vtkTableToArray.h> | ||
|
||
#include <igtlioNDArrayConverter.h> | ||
|
||
// vtksys includes | ||
#include <vtksys/SystemTools.hxx> | ||
|
@@ -187,6 +193,15 @@ unsigned int vtkMRMLIGTLConnectorNode::vtkInternal::AssignOutGoingNodeToDevice(v | |
statusDevice->SetContent(content); | ||
modifiedEvent = vtkMRMLIGTLStatusNode::StatusModifiedEvent; | ||
} | ||
else if (device->GetDeviceType().compare("NDARRAY") == 0) | ||
{ | ||
vtkMRMLTableNode* tableNode = vtkMRMLTableNode::SafeDownCast(node); | ||
vtkDataArray* arr = vtkDataArray::SafeDownCast(tableNode->GetTable()->GetColumn(0)); | ||
//arr->SetComponent(0,0, arr); // This changed | ||
igtlioNDArrayConverter::ContentData content = { arr }; | ||
//device->SetContent(content); | ||
//modifiedEvent = vtkMRMLTableNode::ArrayModifiedEvent; | ||
} | ||
else if (device->GetDeviceType().compare("TRANSFORM") == 0) | ||
{ | ||
igtlioTransformDevice* transformDevice = static_cast<igtlioTransformDevice*>(device.GetPointer()); | ||
|
@@ -290,18 +305,25 @@ void vtkMRMLIGTLConnectorNode::vtkInternal::ProcessIncomingDeviceModifiedEvent( | |
vtkObject* vtkNotUsed(caller), unsigned long vtkNotUsed(event), igtlioDevice* modifiedDevice) | ||
{ | ||
vtkMRMLNode* modifiedNode = this->GetMRMLNodeforDevice(modifiedDevice); | ||
|
||
if (!modifiedNode) | ||
{ | ||
// Could not find or add node. | ||
return; | ||
} | ||
|
||
int wasModifyingNode = modifiedNode->StartModify(); | ||
|
||
const std::string deviceType = modifiedDevice->GetDeviceType(); | ||
const std::string deviceName = modifiedDevice->GetDeviceName(); | ||
|
||
std::cout << deviceType << std::endl; | ||
std::cout << deviceName << std::endl; | ||
int diff = strcmp(deviceType.c_str(), "NDARRAY"); | ||
std::cout << diff << std::endl; | ||
if (this->External->GetNodeTagFromDeviceType(deviceType.c_str()).size() > 0) | ||
{ | ||
std::cout << "anything" << std::endl; | ||
if (strcmp(deviceType.c_str(), "IMAGE") == 0) | ||
{ | ||
igtlioImageDevice* imageDevice = reinterpret_cast<igtlioImageDevice*>(modifiedDevice); | ||
|
@@ -360,6 +382,32 @@ void vtkMRMLIGTLConnectorNode::vtkInternal::ProcessIncomingDeviceModifiedEvent( | |
statusNode->Modified(); | ||
} | ||
} | ||
else if (strcmp(deviceType.c_str(), "NDARRAY") == 0) | ||
{ | ||
std::cout << "Device type is nd array" << std::endl; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove commented lines and re-indent to 2 spaces |
||
igtlioNDArrayDevice* ndarraydevice = reinterpret_cast<igtlioNDArrayDevice*>(modifiedDevice); | ||
if (strcmp(modifiedNode->GetName(), deviceName.c_str()) == 0) | ||
{ | ||
std::cout << "In this NDArray" << std::endl; | ||
vtkMRMLTableNode* tablenode = vtkMRMLTableNode::SafeDownCast(modifiedNode); | ||
vtkSmartPointer<vtkTable> table = vtkSmartPointer<vtkTable>::New(); | ||
//vtkDataArray* dataarray = vtkDataArray::SafeDownCast(ndarraydevice->GetContent().NDArray_msg); | ||
vtkCollection* collectionRef = vtkCollection::SafeDownCast(ndarraydevice->GetContent().collection); | ||
|
||
//dataarray->InsertTuple(0, 0, ); | ||
|
||
/*table->AddColumn(collection); | ||
tablenode->SetAndObserveTable(table); | ||
tablenode->Modified();*/ | ||
for (int i = 0; i < collectionRef->GetNumberOfItems(); ++i) { | ||
vtkDataArray* collection = vtkDataArray::SafeDownCast(ndarraydevice->GetContent().collection->GetItemAsObject(i)); | ||
table->AddColumn(collection); | ||
tablenode->SetAndObserveTable(table); | ||
tablenode->Modified(); | ||
} | ||
|
||
} | ||
} | ||
else if (strcmp(deviceType.c_str(), "TRANSFORM") == 0) | ||
{ | ||
igtlioTransformDevice* transformDevice = reinterpret_cast<igtlioTransformDevice*>(modifiedDevice); | ||
|
@@ -753,6 +801,22 @@ vtkMRMLNode* vtkMRMLIGTLConnectorNode::vtkInternal::GetMRMLNodeforDevice(igtlioD | |
this->External->RegisterIncomingMRMLNode(statusNode, device); | ||
return statusNode; | ||
} | ||
else if (strcmp(device->GetDeviceType().c_str(), "NDARRAY") == 0) | ||
{ | ||
vtkSmartPointer<vtkMRMLTableNode> tableNode = vtkMRMLTableNode::SafeDownCast(this->External->GetScene()->GetFirstNode(deviceName.c_str(), "vtkMRMLTableNode")); | ||
if (tableNode) | ||
{ | ||
this->External->RegisterIncomingMRMLNode(tableNode, device); | ||
return tableNode; | ||
} | ||
tableNode = vtkSmartPointer<vtkMRMLTableNode>::New(); | ||
tableNode->SetName(deviceName.c_str()); | ||
vtkCollection* dataArray = vtkCollection::SafeDownCast(tableNode->GetTable()->GetColumn(0)); | ||
this->External->GetScene()->AddNode(tableNode); | ||
this->External->RegisterIncomingMRMLNode(tableNode, device); | ||
return tableNode; | ||
} | ||
|
||
else if (strcmp(device->GetDeviceType().c_str(), "TRANSFORM") == 0) | ||
{ | ||
vtkSmartPointer<vtkMRMLTransformNode> transformNode = | ||
|
@@ -1077,6 +1141,7 @@ vtkMRMLIGTLConnectorNode::vtkMRMLIGTLConnectorNode() | |
this->Internal->DeviceTypeToNodeTagMap["IMGMETA"] = std::vector<std::string>(1, "ImageMetaList"); | ||
this->Internal->DeviceTypeToNodeTagMap["LBMETA"] = std::vector<std::string>(1, "LabelMetaList"); | ||
this->Internal->DeviceTypeToNodeTagMap["TDATA"] = std::vector<std::string>(1, "IGTLTrackingDataSplitter"); | ||
this->Internal->DeviceTypeToNodeTagMap["NDARRAY"] = std::vector<std::string>(1, "TableNode"); | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
|
@@ -1152,6 +1217,10 @@ std::vector<std::string> vtkMRMLIGTLConnectorNode::GetDeviceTypeFromMRMLNodeType | |
return std::vector<std::string>(1, "STRING"); | ||
} | ||
return std::vector<std::string>(0); | ||
if (strcmp(nodeTag, "NDArrayMessage") == 0) | ||
{ | ||
return std::vector<std::string>(1, "NDARRAY"); | ||
} | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
|
@@ -2534,4 +2603,4 @@ void vtkMRMLIGTLConnectorNode::SetCheckCRC(bool check) | |
bool vtkMRMLIGTLConnectorNode::GetCheckCRC() | ||
{ | ||
return (this->Internal->IOConnector->GetCheckCRC() != 0); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please restore the newline at the end of the file |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove all print statements