Open HanYanxi opened 1 year ago
Hello @HanYanxi ,
I would guess your libvips has been built without openslide support. You should see:
$ vipsheader Mirax2.2-1.mrxs
Mirax2.2-1.mrxs: 101832x219976 uchar, 4 bands, srgb, openslideload
ie. vips has detected an openslide format.
Hello @jcupitt, Thank you for your reply. I checked it. I don't have openslide support. This is what I get. May I ask how can I get the openslide support?
On Windows you need the all
binary:
https://github.com/libvips/build-win64-mxe/releases/download/v8.14.5/vips-dev-w64-all-8.14.5.zip
Thank you. It works. But how can I check how many dimension levels the mrxs image has? And how can I know the shape of each level? I cannot find the document for it.
It's in the image properties. Try:
$ vipsheader -a Mirax2.2-1.mrxs
Mirax2.2-1.mrxs: 101832x219976 uchar, 4 bands, srgb, openslideload
width: 101832
height: 219976
bands: 4
format: uchar
coding: none
interpretation: srgb
xoffset: 0
yoffset: 0
xres: 4275.77
yres: 4267.47
filename: Mirax2.2-1.mrxs
...
openslide.level-count: 10
openslide.level[0].downsample: 1
openslide.level[0].height: 219976
openslide.level[0].width: 101832
openslide.level[1].downsample: 2
openslide.level[1].height: 109988
openslide.level[1].width: 50916
openslide.level[2].downsample: 4
openslide.level[2].height: 54994
openslide.level[2].width: 25458
...
So from Python (for example) you can use:
n_levels = image.get("openslide.level-count")
Thank you! I used "n_levels = image.get("openslide.level-count")" in Python only got a number, like 10. Is that right?
It could be, mrxs files have a lot of levels.
import pyvips svs_file = 'file.mrxs'
img = pyvips.Image.new_from_file(svs_file, level=0)
img2 = img.crop(x1, y1, h, w) img2 = np.asarray(img2, dtype=np.uint8)
I got an attribute error from "level=0"