You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if there is any feature that would enable me to get information on the coordinates of each tile so I can relate it back to the WSI in analysis. The output csv currently just tells me the relative row and column but I am finding it difficult to use that in a meaningful way.
Best,
Gabe
The text was updated successfully, but these errors were encountered:
Hi Gabe,
Currently, there is no built-in feature to save the pixel tile coordinates in the output file. But since the tile sizes and row/column coordinates are included in the output csv, you can calculate the tile position (upper left corner of each tile) from the output file (at the level of output-downsample):
importpandasaspdimportnumpyasnptiles=pd.read_csv("tile_selection.tsv", sep="\t")
# Calculate width position in outputtiles['width_position'] =pd.Series(tiles.groupby('Row').apply(lambdax: np.cumsum(x['Width']).shift(1, fill_value=0)).values)
# Calculate height position in outputheights= [0]
h=0foriinrange(1, tiles.shape[0]):
iftiles['Row'][i] !=tiles['Row'][i-1]:
h+=tiles['Height'][i-1]
heights.append(h)
tiles['height_position'] =pd.Series(heights)
You can (approximately) relate these to the original WSI pixel coordinates through the downsampling factor used (the exact value can be seen when running PyHIST with --info verbose).
You could also change __create_tiles function, namely the value of imgtile_out to a string format that could be more easily interpreted afterwards. I did it by passing the counter i to the np.unravel_index() function and then added the vertical and horizontal subscript in the tile name. In my case I am writing tiles from the base level (downsample=1), if it is not your case you could also add some integer value to the tile_name to get a reference to the level from which it was sampled...
Hello,
I was wondering if there is any feature that would enable me to get information on the coordinates of each tile so I can relate it back to the WSI in analysis. The output csv currently just tells me the relative row and column but I am finding it difficult to use that in a meaningful way.
Best,
Gabe
The text was updated successfully, but these errors were encountered: