Skip to content

[1662] Allow missing keys#1676

Merged
rijobro merged 9 commits intoProject-MONAI:masterfrom
rijobro:missing_keys
Mar 3, 2021
Merged

[1662] Allow missing keys#1676
rijobro merged 9 commits intoProject-MONAI:masterfrom
rijobro:missing_keys

Conversation

@rijobro
Copy link
Copy Markdown
Contributor

@rijobro rijobro commented Mar 2, 2021

Fixes #1662.

Description

Option to not raise exception if keys are missing during transform.

This is my current proposition. I've only done it for a few classes to get opinions before continuing with rest.

The generator in the base class to minimise code duplication.

Status

Work in progress

Types of changes

  • 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).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh --codeformat --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@rijobro rijobro requested review from Nic-Ma and wyli March 2, 2021 10:45
Copy link
Copy Markdown
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I think this a nice direction to go... @jansoe would be great to have your comments as well. I was also thinking of using a special key in keys such as None or * to represent the allow_missing_keys flag... but maybe that's more confusing APIs

Copy link
Copy Markdown

@jansoe jansoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, I think this will make pipelines much more flexible.

@rijobro rijobro changed the title [1662] [WIP] Allow missing keys [1662] Allow missing keys Mar 2, 2021
@rijobro rijobro marked this pull request as ready for review March 2, 2021 15:47
@wyli
Copy link
Copy Markdown
Contributor

wyli commented Mar 2, 2021

/black
/integration-test

Copy link
Copy Markdown
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, it looks good to me

@rijobro rijobro merged commit 421c0a9 into Project-MONAI:master Mar 3, 2021
@rijobro rijobro deleted the missing_keys branch March 3, 2021 12:44
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

Successfully merging this pull request may close these issues.

Add option for transforms to skip missing keys instead of raising exception

3 participants