Open Rasaa84 opened 1 year ago
Hi @Rasaa84, sure, there are lots of speedup tricks.
fetch
is probably faster than crop
.rgb
flag to new_from_file
.But you'd need to make a complete, runnable, standalone benchmark before any tuning could be done.
Did I point you to this sample code? I can't remember: https://github.com/libvips/pyvips/issues/100#issuecomment-493960943
Thanks for your response.
After tissue/background classification using a simple threshold, how can I create high resolution patches only from tissue regions and also keep track of tiles locations (like x,y coordinates of center of each tile)? Because at the end of the day I need to create an overall probability mask for whole image.
Hi @jcupitt ,
I am working on a whole slide image analysis pipeline where I have generated a mask highlighting tissue regions:
image = pyvips.Image.new_from_file(img_path)
slide_gray = slide.colourspace('b-w')
mask = (slide_gray.gaussblur(5) > 200).ifthenelse(0, 1)
My next task involves extracting only the tissue tiles from these highlighted regions. How should I proceed with this?
Thanks in advance for your help.
It depends, I'd experiment. You could try generating all mask tiles, testing for != 0, and only generating those image tiles? That'd be simple.
If you want offline tile generation you could try using the skip-blanks
feature of dzsave
.
I used image.dzsave(os.path.join(out_dir, 'slide'), tile_size=1024, skip_blanks=30)
with different values of skip_blanks but it creates all tiles even from background. Am I missing something?
Hi,
I am currently working on whole slide histology images, and my workflow involves several steps. First, I divide these images into tiles (grid base). Next, I determine whether each tile (patch) contains tissue or not. If a tile includes tissue, I then pass it through a deep classifier. Finally, I generate a mask that visually represents the probability of each tile belonging to a specific class. This is part of my code:
This takes a lot even when I use batch of tiles for processing. Are there more efficient methods I can employ to leverage the speed benefits provided by pyvips?