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

AbsImageFilter sometimes doesn't work #27

Open
dzenanz opened this issue Oct 17, 2024 · 4 comments
Open

AbsImageFilter sometimes doesn't work #27

dzenanz opened this issue Oct 17, 2024 · 4 comments

Comments

@dzenanz
Copy link

dzenanz commented Oct 17, 2024

Trying to apply this filter on an image sometimes results in an error. Input pixel type is short. Log for latest nightly:

myFilter = AbsImageFilter()
myFilter.SetDebug(False)
myFilter.SetNumberOfThreads(24)
myFilter.SetNumberOfWorkUnits(0)
Traceback (most recent call last):
  File "C:/Users/Dzenan/AppData/Local/slicer.org/Slicer 5.7.0-2024-10-15/bin/../lib/Slicer-5.7/qt-scripted-modules/SimpleFilters.py", line 435, in thread_doit
    img = sitkFilter.Execute(*inputImages)
TypeError: Execute() missing 1 required positional argument: 'image1'
Error during execution of AbsImageFilter:

Execute() missing 1 required positional argument: 'image1'

The problem mostly occurs on the first try. It also affects Slicer 5.2.1.

@lassoan
Copy link
Collaborator

lassoan commented Oct 18, 2024

How do you run this filter? Manually, using Simple Filters module GUI?
Is it possible that the image is not ready yet (e.g., the result of a CLI module processing which has not completed yet)?
Do you experience issues with any other filters?

@blowekamp
Copy link
Member

I am suspicious of the value of *inputimages. Perhaps an input is not being selected properly or not "sent" to the module properly when the modules GUI is initialized or something similar.

@dzenanz
Copy link
Author

dzenanz commented Oct 18, 2024

I think that the error occurs if I open Simple Filters before I load an image. If I load the image first, then it is OK. I am not entirely sure of this diagnosis. Attached are the sample image, and screen recording with success and error.
testAbs.zip

@lassoan
Copy link
Collaborator

lassoan commented Oct 19, 2024

Thank you @dzenanz this was very helpful. The problem is due to that an incorrect signal is used for detecting node changes.
nodeActivated is only called when the selection in the node combobox modified due to user action. However, when a volume is loaded and an input node is required (there is no "None" option) then that node gets selected automatically (without user interaction, without emitting nodeActivated signal).

The fix is simple: replace nodeActivated by currentNodeChanged everywhere in the file.

@dzenanz it would be great if you could test it and if it works for you then submit a pull request with the change.

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

3 participants