-
Notifications
You must be signed in to change notification settings - Fork 245
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
Add SlicerIGSpineDeformity extension #1893
base: main
Are you sure you want to change the base?
Conversation
Hi, I wanted to test the module in this extension called "sl_01__LaminaLandmark_Labeling", but I get this error message when I try to add it to my Slicer:
Could you please add instructions to the repository README file on how to install the extension and its dependencies? |
Yes Slicer uses PythonQt and not PyQt. Syntax is similar, but not exact. QFileDialog would be available in Slicer at import qt
qt.QFileDialog |
Probably you could pip install PyQt, but I would not recommend it, because PyQt's free license is a restrictive viral license (GPLv3). We don't explicitly prohibit using GPL code or dependencies in extensions but we highly discourage it, and none of the current extensions in the Slicer extensions index use GPL. PythonQt is a similar (in many aspects better) Python wrapper for Qt, it is already bundled with Slicer core, and has a permissive license (LGPL) that does not limit how you use and distribute your software. @SenonETS I would recommend to update your software to use PythonQt instead of PyQt. If you have any questions about the PythonQt syntax or how to update any specific command in your code then let us know. |
@lassoan I was trying to replace PyQt5 with PythonQt, however, did not find the correct way to import QFileDialog. |
Hi James, Yes, theoretically we can import I am not sure how to import |
Hi Tamas, I am not sure how to import QFileDialog from PythonQt. Would be willing to replace PyQt5 using PythonQt after I figured out. But I did add how to install PyQt5 in my GitHub repository: And you can find an example Scene File for you to test my module. Please let me know if that works for you! |
Hmm, not sure what's not working for you. Can you provide a script to replicate? This works for me (tested on 5.0.3 macOS):
In addition to the license issues that @lassoan pointed out, there's also the issue that Slicer's PythonQt and pip's PyQt may have conflicting libraries that lead to crashes or other odd behavior. I have tried some PySide based code in Slicer in the past and it worked fine on some platforms but would not even load on others. |
Hi Steve, In my python script in the repo, at line 1210, you can find where I called QFileDialog: Originally, QFileDialog require an argument of This is where 3D Slicer will freeze if I call |
How about just using Slicer's main window as the parent, something like this:
|
I changed the code to
But still, 3D Slicer freezes... |
Hi @lassoan , I just tested
However, just like using |
Strange indeed. I just tried on windows and the file dialog works for me. @SenonETS does the freeze happen if you just start a fresh slicer and past the line I posted above into the python console? |
First of all, there should be no reason to open some arbitary npy files. You can store markup lists in nice, human-readable, self-descriptive json or csv file. I would recommend the json format. Also, in general, modules should not deal file reading/writing. It should not matter what file format data nodes are loaded from and saved to. Due to this reason, we very rarely need to put file selectors in module GUIs. Instead, we use node selectors. In the few rare cases when we select files, we usually add a If you are curious why
|
Problem solved! @pieper No, your code does not freeze. The but will freeze if I add the ArgumentName= in front of the argument. Freeze code here:
Not freeze code here:
Thank you @pieper @lassoan ! The problem is solved now! @ungi Please help review the code :). You can download my example SceneFile from here. |
Thank you @lassoan so much for your help! The problem is about assigning arguments using the argument names.
Rearding the npy files, there are two reasons of outputing it:
|
Hi Jean-Christophe, thank you for asking! The further contribution may cover the integration of deep learning for landmark prediction, or spine deformity analysis (which may require 3D ultrasound sequences acquired from Adolescent Idiopathic Scoliosis patients). It is currently not scheduled yet. |
Here is an update of Publications: |
Distribute the custom extension SlicerIGSpineDeformity
Extension build and package works well, and overall the extension seems to be almost ready for integreation. Two remaining small issues to be addressed:
|
Hi @lassoan , Thank you so much for helping me review it! I have changed from "
Please let me know if there is anything else I can do to move forward. |
Distribute the custom extension SlicerIGSpineDeformity
New extension
3d-slicer-extension
GitHub topic so that it is listed here. To edit topics, click the settings icon in the right side of "About" section header and enter3d-slicer-extension
in "Topics" and click "Save changes". To learn more about topics, read https://help.github.com/en/articles/about-topics