-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
OneOf Transform #2551
OneOf Transform #2551
Conversation
Signed-off-by: Lyndon Boone <lyndonboone8@gmail.com>
/build |
3 similar comments
/build |
/build |
/build |
Signed-off-by: Lyndon Boone <lyndonboone8@gmail.com>
Thanks, the update looks good. Some tests are required though before the PR can be merged. I think it would also be really useful to have a go at the inverse method. It should be fairly straightforward. When the method gets called, you just need to store the index of the randomly selected transform. In the inverse direction, you use |
Thanks! I'll try to write some unit tests for it. Would it be best to reference the ones in I can definitely try to have a go at the inverse method as well. Will give it a try and update the PR when finished |
|
Hi @lyndonboone @rijobro , I think the Thanks. |
Good point. Do you think we should just raise a e.g.,
would become
|
Hi @rijobro , Thanks for sharing the idea. Thanks. |
Hi @lyndonboone , May I know your plan for this PR? Do you have some bandwidth to complete it in a short time? Thanks in advance. |
Hi @Nic-Ma , My apologies, I got a little tied up with some other things over the past few weeks. I should be able to get back to this early next week if that works. |
Hi @lyndonboone , Cool, plan sounds good! |
Just catching up with the discussion. I was wondering what to do with the Also, do you think we should use |
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Hi @lyndonboone, I just added the P.S. I wanted to create a PR to your branch but accidentally pushed straight to it. Sorry about that! Feel free to review the modifications and make any changes you might want. |
also i don't think we should do the **kwargs. We have quite a lot of inheritance in our transforms and it would get quite confusing to use kwargs for all of those, since the user would have to check through the documentation for each of the inherited classes. |
Oh awesome, thanks! No worries at all. I'll try to have a go at the unit tests and inverse method |
Signed-off-by: Lyndon Boone <lyndonboone8@gmail.com>
Hi @rijobro , Just added a few more unit tests and an inverse method. Let me know if all looks good and if anything can be improved. |
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
very cool to see my feature request become reality, thanks for your efforts! 🚀 |
|
||
# if applied transform is not InvertibleTransform, throw error | ||
_transform = self.transforms[index] | ||
if not isinstance(_transform, InvertibleTransform): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems we use warning
instead of `exception at other places:
https://github.com/Project-MONAI/MONAI/blob/dev/monai/transforms/inverse_batch_transform.py#L47
Description
Added OneOf transform (subclass of Compose) similar to same name transform in TorchIO
Intended to close #1847
Status
ready (inverse impl. for the dict-based inputs)
Types of changes
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests
.make html
command in thedocs/
folder.