AW: openslide_read_region returns no picture data

Stefan König blogdde at googlemail.com
Fri Dec 10 11:05:53 EST 2010


Sounds good, but there are some doubts, because, the dst. Pointer from
read_region always just contains 0, I'll try this later but I can't imagine
that it will work.



-----Ursprüngliche Nachricht-----
Von: openslide-users-bounces+blogdde=googlemail.com at lists.andrew.cmu.edu
[mailto:openslide-users-bounces+blogdde=googlemail.com at lists.andrew.cmu.edu]
Im Auftrag von Jan Harkes
Gesendet: Freitag, 10. Dezember 2010 17:03
An: openslide-users at lists.andrew.cmu.edu
Betreff: Re: openslide_read_region returns no picture data

On 12/10/2010 02:57 AM, Stefan König wrote:
> here is a part of my sample script to play bit arround with openslide,
> before i use this productive:
>
> 	openslide_read_region(slideObject, dst, 0, 0, 1, *width, *height);
> 	
> 	if(openslide_get_error(slideObject))
> 		std::cout<<  openslide_get_error(slideObject)<<  std::endl;
>
> 	argb8c_view_t gil = boost::gil::interleaved_view(*width, *height,
> (const argb8c_pixel_t*) (dst), (*width)*4);
>
> 	rgb8_image_t exp(*width,*height);
> 	copy_and_convert_pixels(gil, view(exp));
>
> 	jpeg_write_view("C:\\readRegionTest.jpg", view(exp));

I don't know what width and height are set to, but it may be that you 
are clipping some area in the top-left corner of the whole slide image 
where there is no scanned data. In that case the openslide library will 
set the aRGB values all to 0 making the returned region 'transparent 
black'. But as jpeg doesn't support an alpha channel you probably are 
stripping out the transparency resulting in an all black image.

To avoid the black background you would have to composite with the value 
of the openslide.background-color property before stripping the alpha 
channel. This property is pretty new, it was added in version 3.2.3.

Jan
_______________________________________________
openslide-users mailing list
openslide-users at lists.andrew.cmu.edu
https://lists.andrew.cmu.edu/mailman/listinfo/openslide-users



More information about the openslide-users mailing list