Skip to content

SliceInferer for slice-by-slice infererence#3602

Merged
wyli merged 10 commits intoProject-MONAI:devfrom
surajpaib:3458-slice-inferer
Mar 1, 2022
Merged

SliceInferer for slice-by-slice infererence#3602
wyli merged 10 commits intoProject-MONAI:devfrom
surajpaib:3458-slice-inferer

Conversation

@surajpaib
Copy link
Copy Markdown
Contributor

@surajpaib surajpaib commented Jan 7, 2022

Fixes #3458

Description

Addition of SliceInferer to the monai.inferers for slice-by-slice inference on a 3D volume using a 2D model.

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 -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@surajpaib
Copy link
Copy Markdown
Contributor Author

Hi @Nic-Ma, this is the first version of incorporating the SliceInferer into monai.inferers.

What do you think of the implementation? For now, it is the same as what was in the tutorials with better documentation. I'm trying to think of how to make it more readable and concise. Any inputs would be appreciated.

Copy link
Copy Markdown
Contributor

@Nic-Ma Nic-Ma left a comment

Choose a reason for hiding this comment

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

Thanks for the quick implementation!
Put some minor comments inline.
And please add some unit tests to cover the logic.

Thanks.

@Nic-Ma Nic-Ma changed the title SliceInferer for slice-by-slice infererence [WIP] [WIP] SliceInferer for slice-by-slice infererence Jan 9, 2022
@surajpaib
Copy link
Copy Markdown
Contributor Author

Hi @Nic-Ma

Incorporated all the changes you suggested and added a unit test. Let me know if something is missing.

I also changed the logic a bit to make the purpose of the SliceInferer more clear. The old version would fallback and run the SlidingWindowInferer if the roi_size was not provided according to the SliceInferer requirements - this might be confusing to the user, therefore I've changed it to throw a RuntimeError in case the roi_size is not as expected. Added a note to describe what roi_size expects too.

Copy link
Copy Markdown
Contributor

@Nic-Ma Nic-Ma left a comment

Choose a reason for hiding this comment

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

Hi @surajpaib ,

Really sorry for the late response, I missed this PR last week..
Looks good to me, put minor comments inline.
@wyli Could you please help double confirm it?

Thanks.

@surajpaib surajpaib changed the title [WIP] SliceInferer for slice-by-slice infererence SliceInferer for slice-by-slice infererence Jan 24, 2022
@Nic-Ma
Copy link
Copy Markdown
Contributor

Nic-Ma commented Jan 25, 2022

Hi @surajpaib ,

There is some format error in the code according to CI tests:

monai/inferers/inferer.py:262:16: error: Argument 1 to "len" has incompatible type "Union[Sequence[int], int]"; expected "Sized"  [arg-type]
monai/inferers/inferer.py:263:34: error: Argument 1 to "list" has incompatible type "Union[Sequence[int], int]"; expected "Iterable[int]"  [arg-type]
monai/inferers/inferer.py:268:41: error: Argument 2 to "__call__" of "SlidingWindowInferer" has incompatible type "Callable[[Any], Callable[..., Tensor]]"; expected "Callable[..., Tensor]"  [arg-type]
monai/inferers/inferer.py:268:51: error: Incompatible return value type (got "Callable[..., Tensor]", expected "Tensor")  [return-value]
monai/inferers/inferer.py:281:16: error: Incompatible return value type (got "Tensor", expected "Callable[..., Tensor]")  [return-value]

Thanks.

@wyli wyli enabled auto-merge (squash) March 1, 2022 11:07
@wyli wyli merged commit 4ffe6be into Project-MONAI:dev Mar 1, 2022
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.

Extension for cross-dimensional inference with SlidingWindowInferer

3 participants