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

Receiving Images With newProcessedImage Function in pycaster.py Example #149

Open
MarkWijkhuizen opened this issue Dec 14, 2023 · 17 comments

Comments

@MarkWijkhuizen
Copy link

Dear Clarius Support,

After connecting to the Clarius probe using the pycaster.py example with the correct IP address and port all commands seem to work, except the stream action.

# Output after successfully connecting to the Clarius probe
initialization succeeded
connected to 192.168.1.1 on port 37425
press (q)->quit (a)->action (s)->stream (p)->param change: s

The newProcessedImage function is never called for reasons unknown to me.

How could I stream the images on the PC and save them as PNG?

def newProcessedImage(image, width, height, sz, micronsPerPixel, timestamp, angle, imu):
    print(f'newProcessedImage called!') # <- this line is never printed
    bpp = sz / (width * height)
    if printStream:
        print(
            "image: {0}, {1}x{2} @ {3} bpp, {4:.2f} um/px, imu: {5} pts".format(
                timestamp, width, height, bpp, micronsPerPixel, len(imu)
            ),
            end="\r",
        )
    if bpp == 4:
        img = Image.frombytes("RGBA", (width, height), image)
    else:
        img = Image.frombytes("L", (width, height), image)
    img.save("processed_image.png")
    return

Thanks in advance for any help!

@clariusk
Copy link
Contributor

Are you on a Windows system? If so, ensure your firewall has an exception for the python executable, or temporarily disable the firewall.

@MarkWijkhuizen
Copy link
Author

I added an inbound and outbound rule for the Python executable allowing any connection, however, the images are still not streamed.

Which firewall rules should be added to make the streaming work?

@clariusk
Copy link
Contributor

Maybe try a full disable temporarily to see if that helps, suggest removing your Internet connection beforehand

@AriBunnell
Copy link

I added an inbound and outbound rule for the Python executable allowing any connection, however, the images are still not streamed.

Which firewall rules should be added to make the streaming work?

Adding the inbound and outbound rules and completely disconnecting from WiFi before worked for me on my Windows machine.

@MarkWijkhuizen
Copy link
Author

Happy to hear someone got it to work on Windows.
Could you provide the details of your inbound and outbound rules so I could reproduce you configuration?

@deepakraina99
Copy link

I am having the same issue. I am not able to stream it. Pressing 's' does nothing.

@AriBunnell
Copy link

This hasn't been reproducible for me on another Windows computer with the inbound/outbound rules. However, disconnecting from WiFi and/or ethernet and disabling Windows Defender Firewall before connecting to the probe WiFi works for me every time.

@deepakraina99
Copy link

deepakraina99 commented Feb 7, 2024

@AriBunnell Thanks. But not working for me. Want to re-confirm if you are able to stream the real-time ultrasound video on Windows computer using the pycaster.py?

@clariusk
Copy link
Contributor

clariusk commented Feb 7, 2024

and just a note if the program allows you to connect, change parameters, etc. -- you do have a successful connection to the probe via the API, however the UDP stream is being blocked, and firewall, etc, needs to be taken care of. It's more difficult for python since it's the entire python framework you're enabling/disabling, if you choose to use the C++ program, you can set specific firewall rules for that executable

@deepakraina99
Copy link

@AriBunnell Great! Can you let us know the inbound and outbound rules you followed? That would be of great help.

@AriBunnell
Copy link

https://answers.microsoft.com/en-us/windows/forum/all/defender-firewall-and-python/18a32297-42d9-4c6a-8c21-57b52dd163d1

But again, this hasn't been reliable. Disabling firewall is my current solution.

@deepakraina99
Copy link

deepakraina99 commented Feb 7, 2024

@clariusk @AriBunnell Still not working. I have added inbound and outbound rules for python.exe. The firewall is also disabled. But no success so far.

@deepakraina99
Copy link

@clariusk It works with Qt app, I can see the real-time video, but not with pycaster.py. I want to do some processing (deep learning) on real-time ultrasound images. Look forward to your guidance.

@clariusk
Copy link
Contributor

clariusk commented Feb 7, 2024

maybe try Linux :) I run Ubuntu, simple install and have never had issues

@deepakraina99
Copy link

pycaster.py worked but only with v11.0.0, not with the latest v11.1.0 (For some unknown reason)

@julien-l
Copy link
Contributor

julien-l commented Feb 12, 2024

pycaster.py worked but only with v11.0.0, not with the latest v11.1.0 (For some unknown reason)

Maybe due to incompatible versions, try SDK 11.1.0 with app version 11.1.0.

@deepakraina99
Copy link

Yes, we had the app version 11.1.0. I tried with SDK 11.1.0, but it did not work. But 11.1.0 worked!

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

5 participants