histolab / histolab

Library for Digital Pathology Image Processing
http://histolab.readthedocs.io
Apache License 2.0
379 stars 59 forks source link

Coordinate Assignment for Random Tiler #665

Open NeurogliaNerd opened 1 year ago

NeurogliaNerd commented 1 year ago

Hello @alessiamarcolini @Christopher22 ,

From my understanding, when I apply the RandomTiler in Histolab, I get a tile with coordinate information for the bottom left and top right vertices in the file name PVALB054seed16777216tile_1_level0_1980-700-2280-900 ( I added in the other information that is not bolded). However, I'd like to know how these coordinates are calculated, because the image I'm using in this particular example measures 1767 pixels wide by 1519 pixels high. How is Histolab arriving at the numbers it is exporting? I'd appreciate any clarification you may have. Thanks :)

alessiamarcolini commented 9 months ago

Hey @NeurogliaNerd,

the random coordinates calculation is performed here: https://github.com/histolab/histolab/blob/52bb10be6717fd821981147cc29adfa212254f46/histolab/tiler.py#L741-L781

where

All of this is to avoid sampling over huge binary masks. Now, there could be some rounding errors, but I doubt it was SO off.

in this particular example measures 1767 pixels wide by 1519 pixels high

Did you check with slide.dimensions?

If so, could you share a code snippet and the image you used so we can figure it out?