openigtlink / OpenIGTLink

Free, open-source network communication library for image-guided therapy
http://openigtlink.org
BSD 3-Clause "New" or "Revised" License
102 stars 184 forks source link

Missing SetPackPointer and SetBodyPackPointer when using other network library to avoid unnecessary copy #32

Open chaabaj opened 10 years ago

chaabaj commented 10 years ago

I'm using zeromq to exchange message between 2 application and i want to set the pack pointer and the body pack pointer with the message i have received. I have to copy in entire message i have received from zmq to the igtl message. It cause unnecessary copy (example : ImageMessage, PolyData).

tokjun commented 10 years ago

Thanks @chaabaj , for the suggestion. It make sense for the igtl::MessageBase class to have a way to point a memory area allocated externally. I'll work on it later this week to address it.

tokjun commented 10 years ago

For images, you could try the itk::ImageMessage2 class. You can find an example in Examples/Imager/ImagerClient2.cxx Currently the class is separated from the irk::ImageMessage class, because I'm not sure if the API is good enough for the developers.

chaabaj commented 10 years ago

Yes i have tested to divise my igtl message data by block of 16k when igtl message size > 512k and the result was not great. It cost 50ms in additional for data size equal 65mb when i split message. I think the goal of the igtl::ImageMessage2 is to show the image unless you don't have all image data and the application don't have to wait the entire image data. The performance problem is more the copy between zeromq message data from a zeromq socket and igtl message data.