-
Notifications
You must be signed in to change notification settings - Fork 50
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
How to use a pyvips in python to generate tiff format from mrxs #498
Comments
Hello @Fighting-bruceCHN, Yes, they work like any other image format, so maybe: image = pyvips.Image.new_from_file("xxxx.mrxs")
image.write_to_file("yyyy.tif") You'll probably want a certain type of tiff, perhaps: image.write_to_file("yyyy.tif", compression="jpeg", tile=True, pyramid=True) |
Thank you for your help, |
By default, libvips will open the highest resolution level. You can select a level from the MRXS file with the image = pyvips.Image.new_from_file("xxxx.mrxs") When saving a TIFF, by default libvips will write a single uncompressed striped image. You can write other types of TIFF with the various save options. MRXS files always contain the entire slide area, even if the specimen is much smaller, so there is a lot of wasted space. You can use the I suggest: image = pyvips.Image.new_from_file("xxxx.mrxs", autocrop=True)
image.write_to_file("yyyy.tif", compression="jpeg", Q=85, tile=True, pyramid=True) The documentation has all the details: https://www.libvips.org/API/current/VipsForeignSave.html#vips-openslideload https://www.libvips.org/API/current/VipsForeignSave.html#vips-tiffsave |
The
You can see there is a lot of extra information that might be useful. The https://github.com/jcupitt/vipsdisp Press alt-enter to see the image properties: |
Thank you for the reply , still one small question.The tif and tiff suffixes don't affect the nature of the image when saved, right? |
No, there's no difference. |
Hi @jcupitt, I have a question related to this. The output of the vips_openslide function is a rgb or rgba image. I have a mrxs file that has 5 channels. When I open it in libvips, I can see that 4 of the channels are in the four bands. Therefore, I can split the bands and get the channels. I don't know how to obtain the 5th channel though. Is there another parameter I can supply to the vips_openslide function to get other channel? Any idea how how one might retrieve channels from mrxs images that have more that 5 channels? |
Sorry, openslide is RGB only, there's no way to get extra channels. I think you'll need to look into the 3dhistech SDK. |
Hi,
i want to ask if there is a method in pyvips that i can use to transfer a wsi image in mrxs format to the tiff format
Thank you su much for the help
The text was updated successfully, but these errors were encountered: