Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python api] openslide.read_region broke when svs too large #122

Open
fengzhi09 opened this issue Aug 16, 2018 · 2 comments
Open

[python api] openslide.read_region broke when svs too large #122

fengzhi09 opened this issue Aug 16, 2018 · 2 comments

Comments

@fengzhi09
Copy link

Context

Issue type (bug report or feature request): bug report
Operating system (e.g. Fedora 24, Mac OS 10.11, Windows 10): Windows 10
Platform (e.g. 64-bit x86, 32-bit ARM): 64-bit x86
OpenSlide version: 1.1.1
Slide format (e.g. SVS, NDPI, MRXS): svs

Details

call like this:
openslide.open_slide(svs_file)
level = 1
dimension=slide.level_dimensions[level]
// It broken many times.
// Among all broken dimensions of all svs files, min is (25895,21005) max is (89639,51222)
slide.read_region((0, 0), level, dimension)

stack_trace:
File "D:\projects\cancer_ml_project\tools\SVS2PNGConverter.py", line 31, in convert_for_file
imsave(out_folder + "/" + png_file, np.array(slide.read_region((0, 0), level, dimension)))
File "D:\projects\cancer_ml_project\venv\lib\site-packages\openslide_init_.py", line 223, in read_region
level, size[0], size[1])
File "D:\projects\cancer_ml_project\venv\lib\site-packages\openslide\lowlevel.py", line 258, in read_region
buf = (w * h * c_uint32)()
OverflowError: The 'length' attribute is too large

@jxu
Copy link

jxu commented Jul 5, 2019

read_region is for reading relatively small regions that will fit into memory (probably image area < 2^32)
It's usually not possible to read the whole region into memory anyway. That's the point of OpenSlide

@jxu
Copy link

jxu commented Jul 5, 2019

Maybe duplicate of openslide/openslide#73

@bgilbert bgilbert transferred this issue from openslide/openslide Apr 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants