Hello , 3D slicer users
With your help, my project has been successfully completed.
The second project is communication.
I’m going to create a Python module that communicates between admin-client.
admin: Distribute tasks to clients
client : Sends the task to the admin when the task is complete
The question is, I want to configure this module as a slicer extension module so that it works on the python console within the 3D slicer. Is this possible?
Does 3d slicer have support for communication module?
Yes, there are many ways to do this. It will help people understand your goals better if you clarify what type of communication you have in mind (raw tcp, http, other?). And what exactly is the admin program and what is the client (are they both Slicer instances? are they other programs?).
It might help if you look at the WebServer module, which can allow other programs, perhaps your admin program, to control the operation of a Slicer instance, perhaps your client.
Nothing has been decided yet, but I first wondered if communication was possible in the Python console of the 3D slicer.
Yes. Both work only in slicer.
If I deduce my boss’ thoughts, it seems to create a Python module that works with a 3D slicer, and
the client that has finished the work sends the completed slicer task to the admin.
After reading the article you recommended and understanding the concept as much as possible, I will try to ask more detailed questions. thanks for the quick reply
Then yes, using something like the requests module from the admin Slicer instance can allow you to connect to an arbitrary number of client Slicer instances (assign unique tcp ports to each) via the WebServer and the exec API to run python code in the client. Let us know how it works for you.
Yes, when you instantiate the server you can supply a certificate. If you are in a controlled network or the same machine this is really optional. If you are using multiple machines on an open network I suggest creating ssh tunnels instead for security rather than relying on network traffic even if it is encrypted. Web server security is a big topic, so be thoughtful about what you expose.
Hard to say, but if your goal is to transfer this task to a human being who will use slicer to do something like segmentation and then give you back the result it may be easier to use .mrb files with a shared network directory or a system like dropbox. You can make some small scripts if you want to automate this and check that the results are in the right format.
OpenIGTLink is for continuous real-time data like video or 3D tracker data.
The WebServer would allow real-time control of one Slicer instance from another, but maybe not as logical to use when there are human beings involved on the client computer.
Honestly, I’ve never done anything other than data engineering and AI model building, so even looking at the network documentation you linked to, I don’t quite understand.
Q1. The basic framework of the server is already built, and am I adding various options with a command?
Can you give me a code example of building a server and sending and receiving simple data?
If I know the command to turn on the server and send and receive data in the Slicer’s Python console, I think I can do something based on this, but I don’t know how.