openslide_read_region returns no picture data

Adam Goode adam at spicenitz.org
Tue Dec 14 23:52:11 EST 2010


Can you try the openslide-write-png program? Do something like this:

openslide-write-png slide.mrxs 27500 27500 0 1000 1000 out.png

By looking at the result, you might be able to determine where the
problem is.


Adam


On 12/14/2010 04:46 AM, Stefan König wrote:
> i tried it now with this call:
> 
>        openslide_read_region(slideObject, dst, 27500, 27500, 0,
> *width, *height);
> 
> even if i set dimensions to 10000x1000 i get only (big) plane black
> pictures, i tried some different mirax files right now, allways the
> same thing.
> 
> this produces a black image too
> 
> 2010/12/10 Stefan König <blogdde at googlemail.com>:
>> 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));
>>
>>        std::cout << "***************************************" << std::endl;
>>        std::cout << "finished region read" << std::endl;
>>        std::cout << "***************************************" << std::endl;
>>
>>
>>        int64_t* w = new int64_t;
>>        int64_t* h = new int64_t;
>>        const char* name = openslide_get_associated_image_names(slideObject)[1];
>>        openslide_get_associated_image_dimensions (slideObject, name, w, h);
>>        uint32_t* dst2 = new uint32_t[(*w)*(*h)*4];
>>        openslide_read_associated_image (slideObject, name, dst2);
>>
>>        if(openslide_get_error(slideObject))
>>                std::cout << openslide_get_error(slideObject) << std::endl;
>>
>>        argb8c_view_t gil2 = boost::gil::interleaved_view(*w, *h, (const
>> argb8c_pixel_t*) (dst2), *w*4);
>>
>>        rgb8_image_t exp2(*w,*h);
>>        copy_and_convert_pixels(gil2, view(exp2));
>>
>>        jpeg_write_view("C:\\readAssociatedRegionTest.jpg", view(exp2));
>>
>>        std::cout << "***************************************" << std::endl;
>>        std::cout << "finished associated region read" << std::endl;
>>        std::cout << "***************************************" << std::endl;
>>
>> this is my output:
>>
>> the second picture is created successfully, the first one is only
>> black (the dst pointer is empty.), i executed this script by using the
>> mirax sample files from the openslide project page.
>>
>> ***************************************
>> ***************************************
>> finished region read
>> ***************************************
>> ***************************************
>> finished associated region read
>> ***************************************
>>
>>
>> 2010/12/8 Stefan König <blogdde at googlemail.com>:
>>> The error state is empty and a read_associated_image call works fine aber
>>> calling read_region.
>>>
>>> I debugged inside the read_region code, I think there is something wrong
>>> with some of the cairo calls painting to the buffer, but there is no proof
>>> yet.
>>>
>>> Friday I'll take a further look, and I'll write here if I find something.
>>>
>>>
>>> -----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: Mittwoch, 8. Dezember 2010 17:13
>>> An: openslide-users at lists.andrew.cmu.edu
>>> Betreff: Re: openslide_read_region returns no picture data
>>>
>>> On 12/08/2010 10:21 AM, Stefan König wrote:
>>>> Hi,
>>>>
>>>> i try to read a single region out of mirax file (just tried my own and
>>>> the sample files from openslide.org), if i use
>>>> openslide_get_associated_image_dimensions() i can extract my image and
>>>> save work with them but if i try to extract a image by using
>>>> openslide_read_region my dst pointer contains nothing and there is no
>>>> exception either :(
>>>>
>>>>       *width = 256;
>>>>       *height = 256;
>>>>
>>>>       uint32_t* dst = new uint32_t[(*width)*(*height)*4];
>>>>       openslide_read_region(slideObject, dst, 0, 0, 1, *width, *height);
>>>>
>>>> if i understand the documentation right, it should take my slide
>>>> object and write a 256x256 area begining at topleft from layer to dst?
>>>
>>> I believe that that should work. But it may be that the slideObject
>>> handle got into an error state, you probably should check for errors by
>>> calling 'openslide_get_error' after the call to openslide_read_region
>>> and probably most other calls.
>>>
>>> According to the C api documentation, when the object is in error state
>>> openslide_read_region will clear the dst buffer instead of painting to it.
>>>
>>> Jan
>>>
>>> _______________________________________________
>>> openslide-users mailing list
>>> openslide-users at lists.andrew.cmu.edu
>>> https://lists.andrew.cmu.edu/mailman/listinfo/openslide-users
>>>
>>>
>>
> _______________________________________________
> openslide-users mailing list
> openslide-users at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/openslide-users


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
Url : http://lists.andrew.cmu.edu/pipermail/openslide-users/attachments/20101214/317af5c4/attachment.bin 


More information about the openslide-users mailing list