[ome-users] question about Bio-Formats.

Curtis Rueden ctrueden at wisc.edu
Wed Apr 8 16:16:51 BST 2015


Hi Qi,

> I think the Web page you give me is a Java version. In the matlab I
> can't find the openThumbByte function. Do I need to build it by
> myself? Or do you have an example about how to use it?

One of the cool things about MATLAB is that you can call Java API directly.
This is how all the Bio-Formats scripts work, internally. See for example:

https://github.com/openmicroscopy/bioformats/blob/v5.1.0/components/formats-gpl/matlab/bfopen.m#L114-L140

You can pattern your code after that, making calls on the "r" variable as
needed.

Regards,
Curtis

On Wed, Apr 8, 2015 at 10:12 AM, Qi Gong <qigong at gwmail.gwu.edu> wrote:

> Hello Sebastien,
>
> Thank you for your reply. But I think the Web page you give me is a Java
> version. In the matlab I can't find the openThumbByte function. Do I need
> to build it by myself? Or do you have an example about how to use it? Thank
> you.
>
> Sincerely,
> Qi
>
> On Wed, Apr 8, 2015 at 5:45 AM, Sebastien Besson (Staff) <
> s.besson at dundee.ac.uk> wrote:
>
>>  Hi Qi,
>>
>>  all understood and this certainly makes sense.
>> The Bio-Formats API has a method to return bytes corresponding to a
>> thumbnail instead of a full plane, see
>>
>> http://downloads.openmicroscopy.org/bio-formats/5.1.0/api/loci/formats/FormatReader.html#openThumbBytes(int)
>>
>>  This method can be used in the same way that bfGetPlane() makes use
>> openBytes() to retrieve a single
>> plane. Here, the final array would have to be resized by the thumbnail
>> size, typically 128 x 128, instead
>> of the full plane dimensions
>>
>>  Note however that the way to get thumbnails for almost all of the
>> readers is to read the pixels data
>> and scale it internally. For very large WSI, calling this method will
>> likely be restricted to the same memory
>> limitations as reading full planes.
>>
>>  Best regards,
>> Sebastien
>>
>>  On 7 Apr 2015, at 15:53, Qi Gong <qigong at gwmail.gwu.edu> wrote:
>>
>>   Hello Sebastien,
>>
>>  Thank you for your email. I am sorry, my description was not clear. It
>> is not "1-by-1". Now I could extract some sub_area of image, but the
>> extracted image is *1-to-1 *pixel with WSI. What we want is a thumbnail.
>> In other word, we want to display the whole WSI or a large part of WSI in a
>> small size. Thank you.
>>
>>  Sincerely,
>>  Qi
>>
>> On Mon, Apr 6, 2015 at 6:37 PM, Sebastien Besson (Staff) <
>> s.besson at dundee.ac.uk> wrote:
>>
>>> Hi Qi,
>>>
>>>
>>>  Do you need a thumbnail
>>>
>>>
>>>   On 6 Apr 2015, at 22:11, Qi Gong <qigong at gwmail.gwu.edu> wrote:
>>>
>>>  Hello Sebastien,
>>>
>>>
>>>  Hi Qi,
>>>
>>>  Thank you your your reply. I think it is working.
>>>
>>>
>>>  Good to hear.
>>>
>>>   Now, I want to use BIO to get a WSI ( whole slide image) image. But
>>> as the WSI is to large more than 2 GB. I can't use bfopen to open it.
>>> Melissa told me a could use bfGetPlane to get the image.
>>>
>>>
>>>  Indeed, if the image is large enough, reading all the planes into
>>> memory like boffin does simply does not
>>> scale and you have to read selectively.
>>>
>>>   But it extract image is 1-by-1  pixel.
>>>
>>>
>>>  If you have a WSI, it is surprising that the command pasted in a
>>> previous thread would return a single pixel
>>> Can you give us the full dimensions of your image as given by
>>> >> r =  bfGetReader(‘\path\to\file);
>>> >> r.getSizeX()
>>> >> r.getSizeY()
>>>  >> r.getSizeZ()
>>> >> r.getSizeC()
>>>  >> r.getSizeT()
>>> Also, can you paste the command you use to retrieve this 1-by-1 pixel
>>> array?
>>>
>>>   But some time, we need and thumb image of whole image. Do you know
>>> how to extract a 1-by-N image? That means, Extract the whole image (with
>>> size 10000x10000), but only display and save in 100x100 size. Thank you.
>>>
>>>
>>>  Just to be sure, do you want to read a thumbnail for the entire image?
>>> Or are you looking for a way to
>>> retrieve a tile i.e. a XY subset of the full image?
>>>
>>>   Sincerely,
>>> Qi
>>>
>>>
>>>  Best regards,
>>> Sebastien
>>>
>>>
>>> On Mon, Apr 6, 2015 at 3:26 PM, Sebastien Besson <seb.besson at gmail.com>
>>> wrote:
>>>
>>>> Hi Qi,
>>>>
>>>>  the content of your java.opts looks valid (although you might want to
>>>> increase the
>>>> memory settings later). According to the MATLAB documentation, e.g.
>>>>
>>>> http://uk.mathworks.com/help/matlab/matlab_env/java-opts-file.html?refresh=true
>>>> you need to put this file either in the MATLAB startup folder or under
>>>> the `bin\arch` folder
>>>> under the MATLAB root path. Locally, I have a `java.opts` under
>>>> `~/Documents/MATLAB` for
>>>> instance.
>>>>
>>>>  Can you try either of these options and check the output of the
>>>> following command
>>>> >> java.lang.Runtime.getRuntime().maxMemory
>>>> reflects what it in your java.opts
>>>>
>>>>
>>>>  Sebastien
>>>>
>>>>   On 6 Apr 2015, at 19:53, Qi Gong <qigong at gwmail.gwu.edu> wrote:
>>>>
>>>>     Hello everyone,
>>>>
>>>>  Sorry for bother. I try to use  Matlab version of Bio-Formats. But I
>>>> face the memory problem, I know, we could add a time named java.opts to
>>>> solve the problem.
>>>>
>>>>  I put the file the java.opts into matlab folder as attachment. But
>>>> matlab still shows the warning. Could anyone help me check whether my
>>>> java.opts is correct or not? Thank you.
>>>>
>>>>  Sincerely,
>>>> Qi
>>>>
>>>>
>>>>     <matlab folder.png><memory warning.png><java.opts>
>>>> _______________________________________________
>>>> ome-users mailing list
>>>> ome-users at lists.openmicroscopy.org.uk
>>>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> ome-users mailing list
>>>> ome-users at lists.openmicroscopy.org.uk
>>>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>>>>
>>>>
>>>
>>>
>>>  --
>>> mobile phone: 2024060862
>>>  _______________________________________________
>>> ome-users mailing list
>>> ome-users at lists.openmicroscopy.org.uk
>>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>>>
>>>
>>>
>>> The University of Dundee is a registered Scottish Charity, No: SC015096
>>>
>>> _______________________________________________
>>> ome-users mailing list
>>> ome-users at lists.openmicroscopy.org.uk
>>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>>>
>>>
>>
>>
>> --
>> mobile phone: 2024060862
>>  _______________________________________________
>> ome-users mailing list
>> ome-users at lists.openmicroscopy.org.uk
>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>>
>>
>>
>> The University of Dundee is a registered Scottish Charity, No: SC015096
>>
>> _______________________________________________
>> ome-users mailing list
>> ome-users at lists.openmicroscopy.org.uk
>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>>
>>
>
>
> --
> mobile phone: 2024060862
>
> _______________________________________________
> ome-users mailing list
> ome-users at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20150408/7e5e7293/attachment.html>


More information about the ome-users mailing list