<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>There are algorithms available online (I don’t know specifically where, maybe others can point to a direction) that can do both tissue-finding (request A) and focus detection (request B).  My suggestion is to perform the tissue-finding step at the level of the lowest-res image in the pyramid to speed up the I/O – there’s no sense in reading a set of tiles that are ultimately blank and will be discarded anyway.  <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Focus detection has been done for a long time in various ways, although I believe Stumpe’s group at google published a preprint on this earlier this year that might be useful.  Not sure if they’ve shared the code or created an end-user function however.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:12.0pt;color:black'>From: </span></b><span style='font-size:12.0pt;color:black'>openslide-users <openslide-users-bounces+mark.d.zarella=gmail.com@lists.andrew.cmu.edu> on behalf of Sied Kebir <skycrazer@gmail.com><br><b>Date: </b>Tuesday, December 17, 2019 at 1:08 PM<br><b>To: </b><jcupitt@gmail.com><br><b>Cc: </b>"openslide-users@lists.andrew.cmu.edu" <openslide-users@lists.andrew.cmu.edu><br><b>Subject: </b>Re: SVS File Whole Slide Image Tiling<o:p></o:p></span></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><div><p class=MsoNormal>Dear John, <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>thank you so much! I have managed to get tiles from my .svs file. I have two questions now:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>A) Of the image tiles I got, many do not have any informative data, e.g. showing the background for example. How can I remove those?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>B) Some tiles are out of focus, is there a way to remove them as well?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Thanks again!<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Best<o:p></o:p></p></div><div><p class=MsoNormal>Sied<o:p></o:p></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>Am Mi., 11. Dez. 2019 um 09:49 Uhr schrieb <<a href="mailto:jcupitt@gmail.com" target="_blank">jcupitt@gmail.com</a>>:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><p class=MsoNormal>Hello Sied,<br><br>On Wed, 11 Dec 2019 at 06:56, Angelos Pappas <<a href="mailto:angelos@smartcode.gr" target="_blank">angelos@smartcode.gr</a>> wrote:<br>> You can use vips to create Deep Zoom images using the following command:<br>><br>> vips dzsave yourslide.svs yourdzdirectory<br><br>dzsave will make a deepzoom pyramid by default, so a series of levels,<br>with overlapping tiles at each one.<br><br>It has quite a few options -- try:<br><br>    vips dzsave yourslide.svs yourdzdirectory --overlap 0 --tile-size<br>512 --depth one<br><br>And it'll only write the top layer (highest res) of the pyramid, tiles<br>will be 512 x 512, and there will be no overlap. Use --suffix .png if<br>you want PNG tiles.<br><br>You can run it from Python with:<br><br>    import pyvips<br>    image = pyvips.Image.new_from_file("yourslide.svs")<br>    image.dzsave("yourdzdirectory", overlap=0, tile_size=512, depth="one")<br><br>There's a chapter in the libvips manual introducing dzsave:<br><br><a href="https://libvips.github.io/libvips/API/current/Making-image-pyramids.md.html" target="_blank">https://libvips.github.io/libvips/API/current/Making-image-pyramids.md.html</a><br><br>You can also simply crop out tiles in Python:<br><br>    import pyvips<br>    image = pyvips.Image.new_from_file("yourslide.svs")<br>    tile = image.crop(124878, 232445, 512, 512)<br><br>John<br>_______________________________________________<br>openslide-users mailing list<br><a href="mailto:openslide-users@lists.andrew.cmu.edu" target="_blank">openslide-users@lists.andrew.cmu.edu</a><br><a href="https://lists.andrew.cmu.edu/mailman/listinfo/openslide-users" target="_blank">https://lists.andrew.cmu.edu/mailman/listinfo/openslide-users</a><o:p></o:p></p></blockquote></div><p class=MsoNormal>_______________________________________________ openslide-users mailing list openslide-users@lists.andrew.cmu.edu https://lists.andrew.cmu.edu/mailman/listinfo/openslide-users <o:p></o:p></p></div></body></html>