Closed tkobayashi6 closed 2 years ago
Yikes, that is a big difference! Since you're cropping the new image to have to the reference image's shape, the new WSI should have a similar file size as the reference image. This makes me think the larger file size may be due to the image compression method. The default is lzw compression, but perhaps jpeg compression would be better? Valis uses pyvips to save the images, and so a full list of the compression methods can be found here. To use a different compression method, just set compression="jpeg"
(or whichever method you prefer) when calling registrar.warp_and_save_slides
.
Regarding your second question, yes, it is possible to reduce the image size before saving. There are actually several ways this could be done. The easiest way would be to set the the level
argument when calling registrar.warp_and_save_slides
, where level is the pyramid level resolution, so 0 is the full size image, and larger values will get lower resolution images. You can see how many pyramid levels there are, and the size of each one, by looking at each Slide
object's slide_dimensions_wh
attribute (the Slide
objects can be accessed in the Valis
object's slide_dict
attribute). Alternatively, if you'd like more control over the size of each image, then you could resize each registered image before saving, but this would need to be done outside registrar.warp_and_save_slides
, and you would also need to create the ome-xml for each image before saving as an ome.tiff. If you're interested in this approach, I can put together some example code for you. I would normally just do it, but I'm in the process of setting up a new laptop and so it might take a little longer to get it to you. Still happy to put it together if you're interested though.
Best, Chandler
Hello,
The file size of the registration image using VALIS is almost 10 times larger than the original WSI. I checked the source code of VALIS, but could not find the cause.
e.g. Original (ndpi format): 2.7GB ---> Registration (ome.tiff format): 26.3GB
I have two questions.
The code used to run the program is as follows
Best regards,