-
Notifications
You must be signed in to change notification settings - Fork 24
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
Lauras changes #86
base: master
Are you sure you want to change the base?
Lauras changes #86
Conversation
igtl::MessageBase::MetaDataMap& outMetaInfo) | ||
{ | ||
igtl::NDArrayMessage::Pointer msg; | ||
msg = igtl::NDArrayMessage::New(); |
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 use a factory to create the message
bool checkCRC, | ||
igtl::MessageBase::MetaDataMap& outMetaInfo) | ||
{ | ||
igtl::NDArrayMessage::Pointer msg; |
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.
2 space indentation
Converter/igtlioNDArrayConverter.cxx
Outdated
int c = msg->Unpack(checkCRC); | ||
|
||
|
||
cbcbcpa |
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.
What is this*?
Converter/igtlioNDArrayConverter.cxx
Outdated
if (!IGTLtoHeader(dynamic_pointer_cast<igtl::MessageBase>(msg), header, outMetaInfo)) | ||
return 0; | ||
|
||
vtkSmartPointer<vtkDataArray> NDArray_msg = dest->NDArray_msg; |
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.
This shouldn't be copy. Create a new empty pointer
vtkSmartPointer<vtkDataArray> NDArray_msg = vtkSmartPointer<vtkDataArray>::New();
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.
More than that. You'll have to switch on the IGTL array scalar type so you create the correct type of array (vtkFloatArray, vtkIntArray, etc...)
struct ContentData | ||
{ | ||
vtkSmartPointer<vtkDataArray> NDArray_msg; | ||
}; |
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.
The ContentData will also have to store what kind of scalar the array is. Use the IGTL type defines for this.
Converter/igtlioNDArrayConverter.cxx
Outdated
return 0; | ||
|
||
vtkSmartPointer<vtkDataArray> NDArray_msg = dest->NDArray_msg; | ||
NDArray_msg->Allocate(msg->GetPackSize()); |
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.
This isn't always going to be correct if the pack size contains metadata. Use the message values to determine the necessary array size.
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.
eg: msg->GetArray()->GetRawArraySize()
Converter/igtlioNDArrayConverter.cxx
Outdated
|
||
vtkSmartPointer<vtkDataArray> NDArray_msg = dest->NDArray_msg; | ||
NDArray_msg->Allocate(msg->GetPackSize()); | ||
memcpy(NDArray_msg->GetVoidPointer(0), msg->GetPackPointer(), msg->GetBodySizeToRead()); |
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.
Same issue as above, getbodysizetoread may return incorrect array size, use msg->GetArray()->GetRawArraySize()
@LauraConnolly thank you for the pull request. Are you sure that this is the correct version? Having the @adamrankin I asked Laura to commit her changes without cleaning up, so that we can have a look and fix issues. She may or may not have the time to clean things up, but I can do one round of cleanup, as long as the implementation works. |
Pack() call was missing. Added to ImageMeta and LabelMeta messages, too.
* Receive image spacing from image messages * Receive origin from image messages
Triggers updates for attributes such as scalar range.
…GSIO#91) Fixes IGSIO#90 Co-authored-by: Charles Garraud <[email protected]>
Additional support for NDArray messages in Slicer (changed device factory and added a new device)