Closed Dafidofff closed 2 years ago
Thanks. Will look into it. The caching branch is a bunch of experimental features. Will remove and split it into different commits.
This is still pending, but is soon on the list
Can you let me know if you still have this error in the current upstream version?
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days
Describe the bug If I want to add a mask to the TiledROISlideImageDataset I get an attribute error (object not having a shape).
(ellogon) dwessels@hpc2:~/VarMil_lightning$ python dlup_problem.py Traceback (most recent call last): File "/homes/dwessels/VarMil_lightning/dlup_problem.py", line 9, in <module> wsi = TiledROIsSlideImageDataset.from_standard_tiling( File "/homes/dwessels/environments/ellogon/lib/python3.9/site-packages/dlup/data/dataset.py", line 373, in from_standard_tiling return cls(path, [(grid, tile_size, mpp)], crop, mask, mask_threshold, annotations, transform) File "/homes/dwessels/environments/ellogon/lib/python3.9/site-packages/dlup/data/dataset.py", line 304, in __init__ super().__init__( File "/homes/dwessels/environments/ellogon/lib/python3.9/site-packages/dlup/data/dataset.py", line 190, in __init__ boolean_mask[i] = is_foreground(self.slide_image, mask, region, mask_threshold) File "/homes/dwessels/environments/ellogon/lib/python3.9/site-packages/dlup/background.py", line 234, in is_foreground mask_size = np.array(background_mask.shape[:2][::-1]) File "/homes/dwessels/environments/ellogon/lib/python3.9/site-packages/PIL/Image.py", line 548, in __getattr__ raise AttributeError(name) AttributeError: shape
To Reproduce
Expected behavior A clear and concise description of what you expected to happen.
Environment dlup version: dlup-0.2.0 How installed: pip install git+https://github.com/NKI-AI/dlup.git@caching Python version: Python 3.9.2 Operating System: Debian GNU/Linux 11
Additional context This problem occurred on the cashing-branch because there was said to work from that branch instead of main. If I run the same code example from the main-branch I got other errors even deeper within the code (error stated below). However, I do think that the bug stated above will also occur once the other bugs in main are fixed. Because, the erroring line of code is the same in both branches.
My proposed fix for the bug in the Cashing-branch is the following: Currently: line 234, in is_foreground --> mask_size = np.array(background_mask.shape[:2][::-1]) Solution: line 234, in is_foreground --> mask_size = np.array(background_mask).shape[:2][::-1]
So the parentheses should only go around 'background_mask'