Page 1 of 1

original metadata missing with bioformats in matlab

PostPosted: Mon Dec 18, 2017 2:18 pm
by JuliaF
Hi all,

I'm trying to extract all original metadata from a .lif file in matlab using bioformats. I'm using the getSeriesMetadata method on the reader and then selecting the fields that I want from there. Doing this returns 219 metadata fields, but some of the ones I need are missing. When I open the same file with bioformats in imageJ I get 590 fields. getGlobalMetadata returns and empty hash and getCoreMetadataList returns the first ones that also appear on ImageJ but not the missing ones.

This is all I'm doing:
reader = bfGetReader([Path,File]);
seriesMetadata = reader.getSeriesMetadata();
Info = strsplit(string(seriesMetadata),', ')';

Is there a bug or am I doing something wrong? Many thanks in advance!
Julia

Re: original metadata missing with bioformats in matlab

PostPosted: Mon Dec 18, 2017 2:55 pm
by sbesson
Hi Julia,

I'm using the getSeriesMetadata method on the reader and then selecting the fields that I want from there. Doing this returns 219 metadata fields, but some of the ones I need are missing. When I open the same file with bioformats in imageJ I get 590 fields


Can you confirm there is no mismatch in the number of series opened in both environments? The IFormatReader.getSeriesMetadata() API only returns the metadata specific to the current series. The original metadata displayed in ImageJ will combine the global metadata (empty in this case) and the metadata of all selected series.
Is the Leica file containing multiple series and if yes, are the 590 fields in ImageJ displayed when opening only one series?

Is there a bug or am I doing something wrong?


If the same number of series are opened using both environments, it could very well be a bug but. To help us troubleshoot further, we would need you to upload a sample file.

Best,
Sebastien

Re: original metadata missing with bioformats in matlab

PostPosted: Mon Dec 18, 2017 3:24 pm
by JuliaF
Hi Sebastien

In this specific file (4 series) I get 590 fields in ImageJ when I open just one series and 2354 when I open all 4, which are all series metadata repeated 4 times + the extra part in the beginning. In Matlab I only get the 219. I've tried changing the series # in matlab and I always get those same 219. I've only used .lif files but I've seen it with all of them, also if they have just one series.

I've just uploaded a small one, QA Bug | 18854
Many thanks!
Julia

Re: original metadata missing with bioformats in matlab

PostPosted: Tue Dec 19, 2017 4:31 pm
by sbesson
Hi Julia,

thanks for uploading a sample file.

I was able to reproduce your findings on MATLAB using Bio-Formats 5.7.2. Opening the image leads to 219 key/value entries in the first series metadata

Code: Select all
>> r=bfGetReader('no BG.lif');
>> seriesMetadata = r.getSeriesMetadata();
>> Info = size(strsplit(string(seriesMetadata),', ')')
Info =
   219     1


On Fiji, with the current version of the ImageJ, Fiji and Java-8 update site (Bio-Formats 5.7.2), opening the image and displaying the metadata using `Show Info...` leads to 226 entries. The difference between these sizes is due to a few additional metadata fields populated to the FileInfo in the Bio-Formats importer.

Trying to understand what the difference between your ImageJ results and mine, are you using Fiji and if yes, which update sites are enabled? Also could you capture the steps you are performing to open an image in a macro for comparison? On my side, the later gives:

Code: Select all
IJ.run("Bio-Formats Importer", "open=[/Users/sbesson/Desktop/no BG.lif] color_mode=Composite display_ome-xml display_rois rois_import=[ROI manager] view=Hyperstack stack_order=XYCZT use_virtual_stack");


Best,
Sebastien

Re: original metadata missing with bioformats in matlab

PostPosted: Tue Dec 19, 2017 5:53 pm
by JuliaF
Hi Sebastien,

This is getting more weird.. I've opened it in my laptop using ImageJ and I get only 227 fields but in the computer I normally use for image analysis I get 590.
Both are run in the same way:
run("Bio-Formats Importer", "open=[/Users/julia/Google Drive/no BG.lif] color_mode=Default concatenate_series display_metadata view=Hyperstack stack_order=XYCZT");
and the ImageJ folder was directly copied from one computer to another... ImageJ 1.48c
I think I upgraded LOCI in one computer and not another. In the one that returns 590 fields I'm using revision 03770c0 built 19 nov 2012 and in the other b2dd8c7 built 26 Sept 2013, so in the one that returns all the metadata it is using a previous version of bioformats.

Best
Julia

Re: original metadata missing with bioformats in matlab

PostPosted: Tue Dec 19, 2017 6:06 pm
by JuliaF
I've now replaced the bioformats for matlab folder with the equivalent from that release (4.4.8) and loci-tools.jar 4.4.8 and that way I can get all 590 fields. The newest bioformats for Matlab with the old loci-tools.jar also works

Re: original metadata missing with bioformats in matlab

PostPosted: Wed Dec 20, 2017 9:25 am
by sbesson
Hi Julia,

thanks for the additional information. My impression is that you encountered the LIF metadata bug described in this Trac ticket.

This regression should only affect the original metadata of LIF files and for the time being, using 4.4.x as workaround should be sufficient. I will record this thread as another instance of this issue. Ideally, once the issue gets addressed in the mainline of Bio-Formats, you should be able to use the latest version of Bio-Formats across the board.

Best,
Sebastien

Re: original metadata missing with bioformats in matlab

PostPosted: Wed Dec 20, 2017 3:22 pm
by JuliaF
Many thanks!
Best
Julia