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

SaveImage set_options to return self #6146

Closed
wyli opened this issue Mar 14, 2023 · 0 comments · Fixed by #6147
Closed

SaveImage set_options to return self #6146

wyli opened this issue Mar 14, 2023 · 0 comments · Fixed by #6147
Assignees
Labels
enhancement New feature or request

Comments

@wyli
Copy link
Contributor

wyli commented Mar 14, 2023

Describe the bug
follow up of #6136, SaveImage.set_options is not easy to use in a compose transform:

saver = SaveImaged(keys="pred")
saver.set_options(init_kwargs={"affine_lps_to_ras": True})
postprocessing = Compose(
    [
        EnsureTyped(keys=["pred", "seg"]),  # ensure Tensor type after `decollate`
        Activationsd(keys="pred", sigmoid=True),
        ...
        AsDiscreted(keys="pred", threshold=0.5),
        saver,
    ]
)

this is a feature request to support:

postprocessing = Compose(
    [
        EnsureTyped(keys=["pred", "seg"]),  # ensure Tensor type after `decollate`
        Activationsd(keys="pred", sigmoid=True),
        ...
        AsDiscreted(keys="pred", threshold=0.5),
        SaveImaged(keys="pred").set_options(init_kwargs={"affine_lps_to_ras": True}),
    ]
)

which is easily achievable if SaveImage.set_options can return self

@wyli wyli added the enhancement New feature or request label Mar 14, 2023
@wyli wyli self-assigned this Mar 14, 2023
wyli added a commit that referenced this issue Mar 16, 2023
Fixes #6136 
fixes #6146 


### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Wenqi Li <wenqil@nvidia.com>
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

Successfully merging a pull request may close this issue.

1 participant