openigtlink / OpenIGTLink

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

An external Python program calls the slicer plug-in, or installs the plug-in in other software #269

Open ningw-git opened 3 weeks ago

ningw-git commented 3 weeks ago

I am trying to do secondary development based on 3D slicer, using Python language, and now I have encountered a problem, and I am here to ask for your help. I want to use the plug-in OpenIGTLink that calls slcier externally, can I achieve this function? Or can I install this plug-in into my secondary development software? Can you give me some suggestions or ideas?

tokjun commented 3 weeks ago

@ningw-git - It depends on which Slicer features you want to call. You could trigger some event-driven features in 3D Slicer by pushing a message through OpenIGTLink. For example, some image filters support "AutoRun," which starts the process when the input image node is updated. So if you simply push an image message from your external software, you could call the filter. However, since not every module supports "AutoRun," you might need to implement an event handler in 3D Slicer that calls specific features when Slicer receives messages from your external software.

ningw-git commented 3 weeks ago

@@Thank you very much for your answer. I am currently using Python to develop slicer, which is equivalent to developing a new software interface. I now want to call the slicer plug-ins: OpenIGTLink and OpenIGT. I see that the source code is written in C++. Is there any way I can use Python to call them? Or how can I install these two plug-ins in my software? image

@ningw-git - It depends on which Slicer features you want to call. You could trigger some event-driven features in 3D Slicer by pushing a message through OpenIGTLink. For example, some image filters support "AutoRun," which starts the process when the input image node is updated. So if you simply push an image message from your external software, you could call the filter. However, since not every module supports "AutoRun," you might need to implement an event handler in 3D Slicer that calls specific features when Slicer receives messages from your external software.

ningw-git commented 3 weeks ago

Thank you very much for your answer. I am currently using Python to develop slicer, which is equivalent to developing a new software interface. I now want to call the slicer plug-ins: OpenIGTLink and OpenIGT. I see that the source code is written in C++. Is there any way I can use Python to call them? Or how can I install these two plug-ins in my software?

------------------ 原始邮件 ------------------ 发件人: "openigtlink/OpenIGTLink" @.>; 发送时间: 2024年8月15日(星期四) 晚上10:10 @.>; @.**@.>; 主题: Re: [openigtlink/OpenIGTLink] An external Python program calls the slicer plug-in, or installs the plug-in in other software (Issue #269)

@ningw-git - It depends on which Slicer features you want to call. You could trigger some event-driven features in 3D Slicer by pushing a message through OpenIGTLink. For example, some image filters support "AutoRun," which starts the process when the input image node is updated. So if you simply push an image message from your external software, you could call the filter. However, since not every module supports "AutoRun," you might need to implement an event handler in 3D Slicer that calls specific features when Slicer receives messages from your external software.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

ningw-git commented 3 weeks ago

I am trying to do secondary development based on slicer, and I have made a new software using Python. Now I have a problem: how to install the slicer plug-in: OpenIGTLink in my software? Or how to use Python code in the compiler pycharm to call this plug-in? Please help me, as a beginner, I really need help.

ningw-git commented 2 days ago

Thank you very much for your reply, I have solved this problem. Now I have encountered a new difficulty: I wrote a plug-in myself and put the .py file and .ui file in a folder, but I don't know how to import this plug-in module into slicer. Is there any way to implement it in the code or command line? I urgently need your help, thank you.

------------------ 原始邮件 ------------------ 发件人: "openigtlink/OpenIGTLink" @.>; 发送时间: 2024年9月8日(星期天) 凌晨2:57 @.>; @.**@.>; 主题: Re: [openigtlink/OpenIGTLink] An external Python program calls the slicer plug-in, or installs the plug-in in other software (Issue #269)

Hi @ningw-git , OpenIgtlink is now part of SlicerOpenIgtlink, once SlicerOpengitlink is installed, OpenIGTLink library is also included. You can use these commands to send OpenIGTLink messages `>>> a = slicer.vtkMRMLIGTLQueryNode()

a.SetQueryType(a.TYPE_GET) a.SetIGTLName("IMAGE") b = slicer.mrmlScene.GetNodeByID("vtkMRMLIGTLConnectorNode1") #replace the ID with the correct connector node ID b.PushQuery(a)`

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>