Page 1 of 1

Reading metadata from java plugin

PostPosted: Mon Dec 07, 2015 4:26 pm
by phm
Hi,

I'm wondering how to read seriesName with bioformat API from a java plugin. Start some code, but I'm stuck at this level :

Code: Select all
IFormatReader reader;
for (int f = 0; f < imageFile.length;f++) {
            if (imageFile[f].endsWith(".nd")) {
                try {
                    imageName = imageFile[f].substring(0, imageFile[f].indexOf(".nd"));
                    reader.setId(imageDir+imageFile);
                    int series = reader.getSeriesCount();
                    for (int s = 0; s < series; s++) {
                        reader.setSeries(s);
                        int channels = reader.getSizeC();
                        int zStack = reader.getSizeZ();
                        int timePoint = reader.getSizeT();
                        String seriesName  =



Thanks


Philippe

Re: Reading metadata from java plugin

PostPosted: Tue Dec 08, 2015 11:31 am
by bramalingam
Hi,

Please take a look at the following test,
https://github.com/openmicroscopy/biofo ... 1315-L1336

This should help as an example code snippet for extracting the series names.

Likewise, in your case, you might want to try the following :
Code: Select all
String seriesname = reader.getMetadatastore().getImageName(s);


Hope that helps.

Best,
Balaji

Re: Reading metadata from java plugin

PostPosted: Tue Dec 08, 2015 12:13 pm
by phm
bramalingam wrote:Hi,

Please take a look at the following test,
https://github.com/openmicroscopy/biofo ... 1315-L1336

This should help as an example code snippet for extracting the series names.

Likewise, in your case, you might want to try the following :
Code: Select all
String seriesname = reader.getMetadatastore().getImageName(s);


Hope that helps.

Best,
Balaji


Hi Balaji,

I take a look at your link, however, there is not method getImageName(int) in MetadataStore() class ?


Philippe

Re: Reading metadata from java plugin

PostPosted: Tue Dec 08, 2015 1:58 pm
by bramalingam
Hi,

Thanks for your interest in Bio-Formats, please find below a some more technical information, and links to some sample code which you might find useful:

IMetadata is a sub-interface of metadatastore, and this class inherits the methods from
ome.xml.meta.MetadataRetrieve,

https://downloads.openmicroscopy.org/bi ... adata.html

This case is highlighted in the test example as well,
https://github.com/openmicroscopy/biofo ... 1315-L1336

Where :
IMetadata retrieve = (IMetadata) reader.getMetadataStore();
is obtained first and then the corresponding series names are obtained using the getImageName() method.

Hope that helps.

Best,
Balaji

Re: Reading metadata from java plugin

PostPosted: Tue Dec 08, 2015 3:58 pm
by phm
bramalingam wrote:Hi,

Thanks for your interest in Bio-Formats, please find below a some more technical information, and links to some sample code which you might find useful:

IMetadata is a sub-interface of metadatastore, and this class inherits the methods from
ome.xml.meta.MetadataRetrieve,

https://downloads.openmicroscopy.org/bi ... adata.html

This case is highlighted in the test example as well,
https://github.com/openmicroscopy/biofo ... 1315-L1336

Where :
IMetadata retrieve = (IMetadata) reader.getMetadataStore();
is obtained first and then the corresponding series names are obtained using the getImageName() method.

Hope that helps.

Best,
Balaji


Hi Balaji
Thanks for information, the mistake come from the bad import class in my code. I imported loci.formats.meta.IMetadata class instead of ome.xml.meta.IMetadata



Philippe