<p>i use vips a lot... thanks for the pointers...</p>
<div class="gmail_quote">On Mar 30, 2012 4:50 PM, "Benjamin Gilbert" <<a href="mailto:bgilbert@cs.cmu.edu">bgilbert@cs.cmu.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 03/30/2012 03:48 PM, David Gutman wrote:<br>
> Also is there any documentation anywhere for the python-tools? Or do<br>
> I have to just figure it out from doing a dir(python-tools) or<br>
> whatever and walk through the functions?<br>
<br>
Try help('openslide') and help('openslide.deepzoom').<br>
<br>
> I saw there's a write_as_png or something that will write out a<br>
> cropped area from a given layer.. just trying to do something similar<br>
> in an "all" python way (And also want to write a TIFF and not PNG).<br>
<br>
For small layers, you could do:<br>
<br>
slide = OpenSlide('CMU-1.svs')<br>
region = slide.read_region((0, 0), level,<br>
slide.level_dimensions[level])<br>
# region is a PIL.Image<br>
region.save('out.tiff')<br>
<br>
(Note that OpenSlide is now calling layers "levels", since everyone else<br>
already does.)<br>
<br>
However, PIL does not seem to support BigTIFF, or large images<br>
generally. Also, this will load the entire level into RAM. So this<br>
approach is not recommended.<br>
<br>
You may want to check out libvips, which is an image processing library<br>
specifically designed for working with images that cannot fit into RAM.<br>
The current release, version 7.28, can load images from OpenSlide, and<br>
it knows how to write TIFF. Python bindings are available.<br>
<br>
--Benjamin Gilbert<br>
_______________________________________________<br>
openslide-users mailing list<br>
<a href="mailto:openslide-users@lists.andrew.cmu.edu">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><br>
</blockquote></div>