TissueImageAnalytics / tiatoolbox

Computational Pathology Toolbox developed by TIA Centre, University of Warwick.
https://warwick.ac.uk/tia
Other
387 stars 81 forks source link

Misleading error message #881

Open Jiaqi-Lv opened 3 weeks ago

Jiaqi-Lv commented 3 weeks ago

Description

The error message from get_patch_extractor is misleading, when location_list is of invalid type.

What I Did

img = np.zeros((256,256,3))
coords = [[10,10]]
extractor = get_patch_extractor(
    'point',
    input_img = img,
    locations_list = coords,
    patch_size=38
)
TypeError: Please input correct image path or an ndarray image.

The problem is not the image, it's the locations list:

img = np.zeros((256,256,3))
coords = [[10,10]]
extractor = get_patch_extractor(
    'point',
    input_img = img,
    locations_list = np.array(coords),
    patch_size=38
)

This works fine.