Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

If use_roi is set to False, the pretransform will still try to use an roi because of the initialization from dlup #21

Closed
moerlemans opened this issue Nov 22, 2023 · 2 comments · Fixed by #27
Assignees
Labels
bug Something isn't working

Comments

@moerlemans
Copy link
Contributor

moerlemans commented Nov 22, 2023

Describe the bug
In the pretransforms there is an if statement to check for ROI's, but the statement doesn't work as ROIs are always in the sample, but they can be None. The error happens here. Due to the way sample['annotation_data'] is created, the if statement will always pass (as the key "roi" is always present) and then in line 235 it will throw an error as a None object isn't subscriptable

To Reproduce
Run any model in training mode with use_roi=False

Expected behavior
The if-statement should actually check if the ROI is not None

Environment
dlup version:
How installed:
Python version:
Operating System:

Additional context
Add any other context about the problem here.

@moerlemans moerlemans added the bug Something isn't working label Nov 22, 2023
@moerlemans moerlemans self-assigned this Nov 22, 2023
@jonasteuwen
Copy link
Contributor

Can you post a stacktrace?

@moerlemans
Copy link
Contributor Author

moerlemans commented Nov 24, 2023

here there will always be an error thrown if there are no rois because the key "roi" is always made (probably also a typeddict). So the if statement is redundant and should be changed to something like if "roi" in sample["annotation_data"] and sample["annotation_data"]["roi"] is not None:

If you agree I can just replace the if-statement with the above and PR

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants