MCPcopy Create free account
hub / github.com/AIRMEC/HECTOR / crop_rect_from_slide

Function crop_rect_from_slide

extract_features.py:442–447  ·  view source on GitHub ↗
(slide, rect)

Source from the content-addressed store, hash-verified

440 return True
441
442def crop_rect_from_slide(slide, rect):
443 minx, miny, maxx, maxy = rect.bounds
444 # Note that the y-axis is flipped in the slide: the top of the shapely polygon is y = ymax,
445 # but in the slide it is y = 0. Hence: miny instead of maxy.
446 top_left_coords = (int(minx), int(miny))
447 return slide.read_region(top_left_coords, 0, (int(maxx - minx), int(maxy - miny)))
448
449class BagOfTiles(Dataset):
450 def __init__(self, wsi, tiles, resize_to=224):

Callers 1

__getitem__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected