BMIRDS / deepslide

Code for the Nature Scientific Reports paper "Pathologist-level classification of histologic patterns on resected lung adenocarcinoma slides with deep neural networks." A sliding window framework for classification of high resolution whole-slide images, often microscopy or histopathology images.

Home Page:https://www.nature.com/articles/s41598-019-40041-7

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extra JPG tile creation when width/height of SVS divisible by window size

mbluestone opened this issue · comments

I ran into an error while creating JPG tiles from one of my SVS images in 2_svs_to_jpg_tiles.py. One dimension of my image is divisible by the window size for the JPG tile output, so the code was trying to create an extra tile with nothing in it (e.g. begin_x = 20000 and end_x = 20000).

The error seems to stem from these lines in the code, where the number of x and y increments are found:

increment_x = int(width/window_size) + 1
increment_y = int(height/window_size) + 1

If either the width or the height of the SVS image is divisible by the window size then there will be one extra x increment or y increment.

I was thinking these cases could be accounted for by adding:

increment_x = int(width/window_size) + 1 if width%window_size != 0 else int(width/window_size)
increment_y = int(height/window_size) + 1 if height%window_size != 0 else int(height/window_size)

Seems like an easy fix, but let me know if I'm missing something - thanks!

Hey Michael,

Seems like you're right. Can you make this change in a PR?

Jason