Conversation
| igtl::MessageBase::MetaDataMap& outMetaInfo) | ||
| { | ||
| igtl::NDArrayMessage::Pointer msg; | ||
| msg = igtl::NDArrayMessage::New(); |
There was a problem hiding this comment.
Please use a factory to create the message
| bool checkCRC, | ||
| igtl::MessageBase::MetaDataMap& outMetaInfo) | ||
| { | ||
| igtl::NDArrayMessage::Pointer msg; |
Converter/igtlioNDArrayConverter.cxx
Outdated
| int c = msg->Unpack(checkCRC); | ||
|
|
||
|
|
||
| cbcbcpa |
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.
This shouldn't be copy. Create a new empty pointer
vtkSmartPointer<vtkDataArray> NDArray_msg = vtkSmartPointer<vtkDataArray>::New();
There was a problem hiding this comment.
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.
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.
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.
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.
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.
Additional support for NDArray messages in Slicer (changed device factory and added a new device)