openigtlink / OpenIGTLink

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

Response to Query/GET if data is not available #255

Open tpaetz opened 2 years ago

tpaetz commented 2 years ago

According to the documentation, the following behavior has to be used if data for a response to a GET message is not available:

"GET" query message is used to request for a single message with type . The receiver of "GET" message must return a message with type and the same name as the query message. A "GET" message without device name requests any available data. If data is not available, a returned message must be null body (data size = 0). A format of "GET" may be defined per data type, if necessary.

How to interpret this with OpenIGTLink_HEADER_VERSION == 2, i.e. with extended header and meta data? Should this be done via a message that may carry meta data and the extended header but with a content size == 0? Or should a fallback to protocol version 1 without meta data and extended header be used in such a case? Is OpenIGTLink prepared to process messages without content?

leochan2009 commented 1 year ago

Hi Torben,

I think the Get_ message should work both with header_version == 2 and 1. OpenIGTLink is able to process the message without content. The application should be able to get the message type from the header; for example, the Get_ImageMesage has a message type of "GET_IMAGE": https://github.com/openigtlink/OpenIGTLink/blob/master/Source/igtlImageMessage.h#L36

As you mentioned, in the case of OpenIGTLink_HEADER_VERSION == 2 with extended header and meta data. The mesage should carry meta data and the extended header but with a content size == 0. So in Header_version==2, the whole message length will be HEADER_size(58)+ExtenderHeaderSize(14)+2 bytes for (indexing purpose in the meta data) + 0 content size= 74 Bytes in total