Page 1 of 1

reading metadata

PostPosted: Tue Mar 20, 2018 11:06 am
by phm
Hi,
I trying to get the value of overlap metadata in ome.tif Lavision image. Opening image in Fiji with Bioformats and metadata actived shown the field :
Code: Select all
xyz-Table_XY_Overlap   10.000000

However, using java code as :
Code: Select all
ServiceFactory factory;
factory = new ServiceFactory();
OMEXMLService service = factory.getInstance(OMEXMLService.class);
IMetadata meta = service.createOMEXMLMetadata();
ImageProcessorReader reader = new ImageProcessorReader();
reader.setMetadataStore(meta);
reader.setId(imageDir+imageFile[0]);
int series = 0;
reader.setSeries(series);
double sx = meta.getPixelsPhysicalSizeX(series).value().doubleValue();
double sy = meta.getPixelsPhysicalSizeY(series).value().doubleValue();
double sz = meta.getPixelsPhysicalSizeZ(series).value().doubleValue();
cal.pixelWidth = sx;
cal.pixelHeight = sy;
cal.pixelDepth = sz;
cal.setUnit("microns");
String overlapMetadata = "xyz-Table_XY_Overlap";
String overlap =reader.getSeriesMetadataValue(overlapMetadata).toString());

return a null pointer exception for overlap but not sx, sy or sz ????
Philippe

Re: reading metadata

PostPosted: Wed Mar 21, 2018 9:13 am
by mtbc
Dear Philippe,

Perhaps that key is among the global rather than the series metadata? You can check using showinf -nopix as at https://docs.openmicroscopy.org/latest/ ... splay.html

If you still have trouble, please do feel free to paste to us the output of showinf applied to your file or even just upload the image to http://qa.openmicroscopy.org.uk/qa/upload/ with a covering comment and we should be glad to take a look.

Cheers,
Mark

Re: reading metadata

PostPosted: Wed Mar 21, 2018 1:47 pm
by phm
Hi Mark,
I uploaded the file 11-30-56_140218E17-5netpattehomo4 x 3-2_UltraII[00 x 00]_C00_xyz-Table Z0000.ome.tif
on your server.
Thanks
Philippe

Re: reading metadata

PostPosted: Wed Mar 21, 2018 2:20 pm
by mtbc
Dear Philippe,

Yes, showinf shows that the overlay's in the global metadata, not the series metadata. Try instead something like,

Code: Select all
String overlap = reader.getGlobalMetadata().get(overlapMetadata).toString();


Cheers,
Mark

Re: reading metadata

PostPosted: Wed Mar 21, 2018 2:51 pm
by phm
mtbc wrote:Dear Philippe,

Yes, showinf shows that the overlay's in the global metadata, not the series metadata. Try instead something like,

Code: Select all
String overlap = reader.getGlobalMetadata().get(overlapMetadata).toString();


Cheers,
Mark


Solved !
Thanks Mark,

Philippe