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

support modifying transform arguments in different class types #20

Open
nvahmadi opened this issue Jun 27, 2023 · 1 comment
Open

support modifying transform arguments in different class types #20

nvahmadi opened this issue Jun 27, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@nvahmadi
Copy link

Hi,
great tool so far! I am trying to apply a Lambdad function in my transform chain.
For example, after LoadImaged I want to apply the transform:

Lambdad(keys=["image"], func=lambda x: x.squeeze())

If I add the Lambdad transform in my stack in the MONAIViz panel, and I add the params keys=["image"] and func=lambda x: x.squeeze(), I receive the following error message:

Traceback (most recent call last):
  File "C:/Projects/SlicerMONAIViz/MONAIViz/MONAIViz.py", line 537, in onRunTransform
    t = eval(exp)
  File "<string>", line 1
    monai.transforms.Lambdad(keys=['image'], func=<function <lambda> at 0x0000017BD75F3280>)
                                                  ^
SyntaxError: invalid syntax

I am not sure what's happening under the hood in this module - would a lambda eval even be possible?
Thanks in advance!

@wyli
Copy link
Contributor

wyli commented Aug 16, 2023

Screenshot 2023-08-16 at 11 51 11

the textboxes doesn't seem to support anything beyond the built-in simple types, for example dtype=float will generate the error

  File "<string>", line 1
    foo(keys=['image', 'label'], dtype=<class 'float'>)
                                       ^
SyntaxError: invalid syntax

(I think this part could be enhanced with monai.bundle.ConfigParser https://docs.monai.io/en/stable/config_syntax.html)

@wyli wyli added the enhancement New feature or request label Aug 16, 2023
@wyli wyli changed the title How to apply Lambdad transforms? support modifying transform arguments in different class types Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants