Closed jameshball closed 1 year ago
Hello James, thanks a lot for the message. I tried to reproduce the problem, but had no success. Do you use the latest (2.0.8) version? If not, please upgrade. I recently made a few fixes that may solve the problem. Should the problem persist, please share with me the following information about the problematic image:
If possible, please share the image with us, as it would greatly assist us in reproducing and fixing the problem. However, this may not be necessary in this case. Best regards, Stanislav
Thanks for the quick reply - will try the latest version tomorrow and get back to you asap with the extra info if it doesn't work!
Doh! I was on 1.0.4, but I have just upgraded to 2.0.8 and it seems to be working fine now. Thanks for your help - maybe this is worth noting somewhere as although in hindsight it's obvious I should have tried updating, it would have been much easier to solve if it was flagged somewhere as a bug in a previous version :)
Thanks so much for your help!
Hi,
I've been facing some issues when using the
slideio
python library, particularly with theread_block
function.First an explanation of what I'm trying to achieve (can be skipped but as an extra reference for clarity):
I am trying to read blocks of 40000x40000 (as determined by
MAG_LEVEL_SIZES
andself.magnification_level
) from SVS files that vary in size significantly.Many images are smaller than 40000 pixels in one dimension or both, so I crop the width and height and change the x and y coordinates if necessary.
In short, I am trying to take a center crop of an image, without stretching or rescaling
I then want to rescale the image to fit into a 1024x1024 image (determined by
self.patch_size
) without scaling it up or down relative to differently sized images. This means if there is a 10000x10000 image, then the resulting patch should be 256x256 since 10000 is 4x less than the desired crop of 40000 and so 256 is 4x less than the desired crop of 1024.The important line of code here is:
When I run this, it works on almost all SVS files, but there are a few that throw the following error on the
read_block
line:(the opencv assertion is here https://github.com/npinto/opencv/blob/42f7329c788bf2eb60b2c1de2ed8efb91ae84cde/modules/core/src/matrix.cpp#L321)
This would seem to indicate a problem with the rectangle coordinates and width/height I passed in.
The dimension of the SVS file this fails for is 52188x37393 and below are the values I used for cropped_x, cropped_y, cropped_width, cropped_height, patch_width, and patch_height, and whether the error was thrown or not.
The first row in the table above are the values that I actually want to run this with, the rest are just me testing whether it works or not.
I expected this to work for every single one of the entries in the table above, and have no idea why it suddenly starts working when cropped_width < 39997 even though 6094 + 40000 < 52188. I also thought that the size parameter (i.e. patch_width/height) should have no impact on whether this fails, but clearly when size=(0,0) this works fine.
I've been trying to figure this out for the last few days so any help at all would be super appreciated!
Thanks, James