Skip to content
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

Sending of large messages is slow #2

Open
Nikzt opened this issue Jun 19, 2015 · 1 comment
Open

Sending of large messages is slow #2

Nikzt opened this issue Jun 19, 2015 · 1 comment

Comments

@Nikzt
Copy link

Nikzt commented Jun 19, 2015

Problem is that the Java implementation in Matlab cannot accept raw buffers and each byte has to be sent out separately.
Recent Matlab versions have the tcpclient function, use that instead - those can send large buffers at once.

It would be nice if this could be implemented in a backward-compatible way so that people who have older Matlab can use the library, too.

@lassoan
Copy link

lassoan commented Sep 30, 2015

You need to change this file:
https://github.com/SlicerIGT/MatlabOpenIGTLink/blob/master/src/OpenIGTLinkMessageReceiver.m

  1. Replace ReadWithTimeout with tcpread
    Do it in a backward-compatible manner: use a function handle to the old or new ReadWithTimeout implementation.
  2. Replace this block with some memory/type casting to avoid iterating through the pixels one by one:
    data.pixelData = zeros(volumeSizeI, volumeSizeJ, volumeSizeK);
    for kIndex=1:volumeSizeK
    for jIndex=1:volumeSizeJ
    for iIndex=1:volumeSizeI
    data.pixelData(i,j,k) = convertFromUint8VectorToFloat64(body(i:i+8)); i = i + 8;
    end
    end
    end
  3. Get rid of global variables along the way.

franklinwk added a commit to franklinwk/MatlabOpenIGTLink that referenced this issue Nov 18, 2015
SlicerIGT#2 Performance improvement for large image messages (using typecasts)
Added support for multiple scalar data types for image messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants