8000 Change signature for read_region by jonasteuwen · Pull Request #86 · NKI-AI/ahcore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

Change signature for read_region #86

Closed
wants to merge 1 commit into from
Closed

Conversation

jonasteuwen
Copy link
Contributor

This PR prepares for the upcoming dlup 0.4.

- Update black in .pre-commit-config.yaml
- Force strict mypy and exclude auxiliary directories
Copy link
Contributor
@VanessaBotha VanessaBotha left a comment

Choose a reason for hiding this comment

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

It looks good to me, but had some questions

@@ -325,6 +263,31 @@ def read_region_raw(self, location: tuple[int, int], size: tuple[int, int]) -> G

return stitched_image

def read_region(self, location: tuple[int, int], level: int, size: tuple[int, int]) -> GenericNumberArray:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do I understand this correctly?
scaling=1 is the same as level=0 and has it now been decided to not support scaling other than 1 (therefore all other code in the old read_region function is no longer needed)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Are there no places in the ahcore codebase where the (old) .read_region function is called?
In the new code, the scaling argument has been changed to level.
Assuming that scaling=1 is the same as level=0, I would expect this should be changed in places where read_region is called to preserve the same functionality. I don't see this in the changes
(I only see replacement of .read_region_raw --> .read_region)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @VanessaBotha,

I think I’ve replaced the calls with the new signature. The new signature is compatible with the openslide read_region. We have a SlideImage class that wraps it to a function with a scaling parameter. So eventually it is the idea to replace the class with a Backend so we can read at an arbitrary resolution (scaling). That will be dlup, and is now a PR

Copy link
Contributor
@VanessaBotha VanessaBotha Jun 5, 2024

Choose a reason for hiding this comment

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

Oke clear!
Regarding the signature change: what I meant is that I expected changes like this to be needed in places where the old .read_region function was called in ahcore:
.read_region(location, 1, size) —> .read_region(location, 0, size)
Unless the old .read_region was never used in ahcore

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0