1977 Support different inverse interpolation mode#1978
1977 Support different inverse interpolation mode#1978wyli merged 21 commits intoProject-MONAI:masterfrom
Conversation
merge master
merge master
merge master
Signed-off-by: Nic Ma <[email protected]>
Signed-off-by: Nic Ma <[email protected]>
Signed-off-by: Nic Ma <[email protected]>
Signed-off-by: Nic Ma <[email protected]>
Signed-off-by: Nic Ma <[email protected]>
Signed-off-by: Nic Ma <[email protected]>
Signed-off-by: monai-bot <[email protected]>
merge master
Signed-off-by: Nic Ma <[email protected]>
1866 add inverse handler
Signed-off-by: Nic Ma <[email protected]>
|
This PR depends on: #1970 Thanks. |
|
/black |
|
/integration-test |
|
Could the same be achieved with a withable (which wouldn't require adding with nearest_neighbour_transforms(*transforms):
# if Compose, get list (same logic as in allow_missing_keys_mode)
all_transforms = ...
# get sublist of all transforms that contain `mode`.
# might need recursion for transforms that contain transforms.
mode_transforms = [i for i in all_transforms if hasattr(i, mode)]
# record previous values
orig_modes = [i.mode for i in mode_transforms]
try:
# Set all to nearest_neighbour
for i in mode_transforms:
i.mode = 'nearest-neighbour'
yield
finally:
# Revert
for t, o_s in zip(mode_transforms, orig_modes):
t.allow_missing_keys = o_sCould even be generalised to |
|
Hi @rijobro , Thanks for your suggestion. Thanks. |
|
Ok that sounds like good motivation for doing it your way. You've put the logic of modifying def inverse(self, data, **extra_info):
d = deepcopy(dict(data))
for key in self.key_iterator(d):
# replace any elements in d["EXTRA_INFO"] with **extra_info
...and then we'd call it with What do you think? |
|
Hi @rijobro , Thanks for your suggestion, do you mean to add the |
Signed-off-by: Nic Ma <[email protected]>
|
Hi @rijobro , I think we can make the logic into a util function, then users can use it without ignite, what do you think? Thanks. |
I feel this is necessary for general usability, but we should do it in a separate PR as a new feature implementation? perhaps we don't have time for this new feature in v0.5... |
|
/integration-test |
Signed-off-by: Nic Ma <[email protected]>
Signed-off-by: Nic Ma <[email protected]>
Signed-off-by: Nic Ma <[email protected]>
Signed-off-by: monai-bot <[email protected]>
|
@Nic-Ma looks great, thanks! |
* [DLMED] add TransformInverter handler Signed-off-by: Nic Ma <[email protected]> * [DLMED] fix typo Signed-off-by: Nic Ma <[email protected]> * [DLMED] add support in SegmentationSaver handler Signed-off-by: Nic Ma <[email protected]> * [DLMED] fix flake8 issue Signed-off-by: Nic Ma <[email protected]> * [DLMED] fix flake8 issue Signed-off-by: Nic Ma <[email protected]> * [DLMED] fix CI test Signed-off-by: Nic Ma <[email protected]> * [MONAI] python code formatting Signed-off-by: monai-bot <[email protected]> * [DLMED] save mode into inverse dict Signed-off-by: Nic Ma <[email protected]> * [DLMED] add unit tests Signed-off-by: Nic Ma <[email protected]> * [DLMED] fix ToTensor inverse issue Signed-off-by: Nic Ma <[email protected]> * [DLMED] change the replacement logic into util function Signed-off-by: Nic Ma <[email protected]> * [DLMED] add more tests Signed-off-by: Nic Ma <[email protected]> * [DLMED] fix flake8 Signed-off-by: Nic Ma <[email protected]> * [MONAI] python code formatting Signed-off-by: monai-bot <[email protected]> Co-authored-by: monai-bot <[email protected]> Signed-off-by: Neha Srivathsa <[email protected]>
Fixes #1977
Description
This PR added support to use different interpolation mode in inverse transforms.
Status
Ready
Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests.make htmlcommand in thedocs/folder.