Skip to content

Tutorial/Demo for Modular Patch Inferer #1316

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

Merged
merged 27 commits into from
Jun 7, 2023

Conversation

bhashemian
Copy link
Member

@bhashemian bhashemian commented Apr 17, 2023

Description

This PR adds a notebook to demonstrate how the new modular patch inference can used:

  • PatchInferer
  • AvgMerger
  • SlidingWindowSplitter
  • WSISlidingWindowSplitter

Checks

  • Avoid including large-size files in the PR.
  • Clean up long text outputs from code cells in the notebook.
  • For security purposes, please check the contents and remove any sensitive info such as user names and private key.
  • Ensure (1) hyperlinks and markdown anchors are working (2) use relative paths for tutorial repo files (3) put figure and graphs in the ./figure folder
  • Notebook runs automatically ./runner.sh -t <path to .ipynb file>

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@Nic-Ma
Copy link
Contributor

Nic-Ma commented May 29, 2023

Hi @drbeh , do you plan to complete this PR for review?

Thanks.

@bhashemian
Copy link
Member Author

Hi @drbeh , do you plan to complete this PR for review?

Thanks.

Yes, I'll do it shortly.

@bhashemian bhashemian marked this pull request as ready for review May 30, 2023 18:55
@bhashemian bhashemian marked this pull request as draft May 30, 2023 19:55
@bhashemian bhashemian marked this pull request as ready for review May 30, 2023 20:01
@bhashemian bhashemian requested a review from KumoLiu May 30, 2023 23:16
Signed-off-by: Behrooz <[email protected]>
@bhashemian bhashemian requested a review from Nic-Ma May 31, 2023 19:04
@review-notebook-app
Copy link

review-notebook-app bot commented Jun 1, 2023

View / edit / reply to this conversation on ReviewNB

KumoLiu commented on 2023-06-01T06:05:48Z
----------------------------------------------------------------

Duplicated "to" in the first line.

"The core to to a modular patch".


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 1, 2023

View / edit / reply to this conversation on ReviewNB

KumoLiu commented on 2023-06-01T06:05:49Z
----------------------------------------------------------------

Missing title for this cell and the following cell?

And can we also add a raw image here?


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 1, 2023

View / edit / reply to this conversation on ReviewNB

KumoLiu commented on 2023-06-01T06:05:50Z
----------------------------------------------------------------

Line #22.    fig.suptitle(f"Patch filtering by a threshold (without padding, {patch_size=})", fontsize=24)

A wrong patch size here for the title.


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 3, 2023

View / edit / reply to this conversation on ReviewNB

Nic-Ma commented on 2023-06-03T09:32:29Z
----------------------------------------------------------------

I think we usually don't need to put the program code design diagram in tutorial, what do you think?

Thanks.


@Nic-Ma
Copy link
Contributor

Nic-Ma commented Jun 3, 2023

View / edit / reply to this conversation on ReviewNB

Nic-Ma commented on 2023-06-03T09:32:29Z ----------------------------------------------------------------

I think we usually don't need to put the program code design diagram in tutorial, what do you think?

Thanks.

@wyli @ericspod What do you think?

Thanks.

@ericspod
Copy link
Member

ericspod commented Jun 3, 2023

View / edit / reply to this conversation on ReviewNB
Nic-Ma commented on 2023-06-03T09:32:29Z ----------------------------------------------------------------
I think we usually don't need to put the program code design diagram in tutorial, what do you think?
Thanks.

@wyli @ericspod What do you think?

Thanks.

I'm fine with more information in tutorials especially for a design concept that requires a little explanation. We can do embedded images directly in the notebook rather than linking to a file if you wanted to not have it. Thanks!

@bhashemian
Copy link
Member Author

@KumoLiu @Nic-Ma please let me know if you have any other comments.

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Jun 7, 2023

Hi @drbeh ,

I see 1 error in the CI:

    510 elif self.backend == "openslide":
--> 511     self.reader = OpenSlideWSIReader(
    512         level=level,
    513         mpp=mpp,
    514         mpp_rtol=mpp_rtol,
    515         mpp_atol=mpp_atol,
    516         power=power,
    517         power_rtol=power_rtol,
    518         power_atol=power_atol,
    519         channel_dim=channel_dim,
    520         dtype=dtype,
    521         device=device,
    522         mode=mode,
    523         **kwargs,
    524     )
    525 elif self.backend == "tifffile":
    526     self.reader = TiffFileWSIReader(
    527         level=level,
    528         mpp=mpp,
   (...)
    538         **kwargs,
    539     )

File /opt/conda/lib/python3.8/site-packages/monai/utils/module.py:488, in require_pkg.<locals>._decorator.<locals>._wrapper(*args, **kwargs)
    486 err_msg = f"required package `{pkg_name}` is not installed or the version doesn't match requirement."
    487 if raise_error:
--> 488     raise OptionalImportError(err_msg)
    489 else:
    490     warnings.warn(err_msg)

OptionalImportError: required package `openslide` is not installed or the version doesn't match requirement.


Check failed!

If you have any questions about the CI execution env, maybe @mingxin-zheng and @wyli can help.

Thanks in advance.

@bhashemian
Copy link
Member Author

Hi @drbeh ,

I see 1 error in the CI:

    510 elif self.backend == "openslide":
--> 511     self.reader = OpenSlideWSIReader(
    512         level=level,
    513         mpp=mpp,
    514         mpp_rtol=mpp_rtol,
    515         mpp_atol=mpp_atol,
    516         power=power,
    517         power_rtol=power_rtol,
    518         power_atol=power_atol,
    519         channel_dim=channel_dim,
    520         dtype=dtype,
    521         device=device,
    522         mode=mode,
    523         **kwargs,
    524     )
    525 elif self.backend == "tifffile":
    526     self.reader = TiffFileWSIReader(
    527         level=level,
    528         mpp=mpp,
   (...)
    538         **kwargs,
    539     )

File /opt/conda/lib/python3.8/site-packages/monai/utils/module.py:488, in require_pkg.<locals>._decorator.<locals>._wrapper(*args, **kwargs)
    486 err_msg = f"required package `{pkg_name}` is not installed or the version doesn't match requirement."
    487 if raise_error:
--> 488     raise OptionalImportError(err_msg)
    489 else:
    490     warnings.warn(err_msg)

OptionalImportError: required package `openslide` is not installed or the version doesn't match requirement.


Check failed!

If you have any questions about the CI execution env, maybe @mingxin-zheng and @wyli can help.

Thanks in advance.

That's right, @Nic-Ma! I believe openslide library is not being installed in the CI/CD. I can add it but let me see if I can make things work with cucim, so we can avoid additional time that installing the library will take for each test.

@bhashemian
Copy link
Member Author

It passed all tests with cucim. Will merge it.

@bhashemian bhashemian merged commit 5974486 into Project-MONAI:main Jun 7, 2023
@bhashemian bhashemian deleted the patch_inferer branch June 7, 2023 02:09
boneseva pushed a commit to boneseva/MONAI-tutorials that referenced this pull request Apr 21, 2024
### Description
This PR adds a notebook to demonstrate how the new [modular patch
inference](Project-MONAI/MONAI#5837) can used:
- `PatchInferer`
- `AvgMerger`
- `SlidingWindowSplitter`
- `WSISlidingWindowSplitter`

### Checks
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Avoid including large-size files in the PR.
- [x] Clean up long text outputs from code cells in the notebook.
- [x] For security purposes, please check the contents and remove any
sensitive info such as user names and private key.
- [x] Ensure (1) hyperlinks and markdown anchors are working (2) use
relative paths for tutorial repo files (3) put figure and graphs in the
`./figure` folder
- [x] Notebook runs automatically `./runner.sh -t <path to .ipynb file>`

---------

Signed-off-by: Behrooz <[email protected]>
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.

3 participants