We're Hiring!

Reading metadata from java plugin

Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats
Please note:
Historical discussions about the Bio-Formats library. Please look for and ask new questions at https://forum.image.sc/tags/bio-formats

If you are having trouble with image files, there is information about reporting bugs in the Bio-Formats documentation. Please send us the data and let us know what version of Bio-Formats you are using. For issues with your code, please provide a link to a public repository, ideally GitHub.

Reading metadata from java plugin

Postby phm » Mon Dec 07, 2015 4:26 pm

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
phm
 
Posts: 185
Joined: Tue Mar 19, 2013 3:39 pm

Re: Reading metadata from java plugin

Postby bramalingam » Tue Dec 08, 2015 11:31 am

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
User avatar
bramalingam
 
Posts: 70
Joined: Tue Jan 14, 2014 12:01 pm

Re: Reading metadata from java plugin

Postby phm » Tue Dec 08, 2015 12:13 pm

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
phm
 
Posts: 185
Joined: Tue Mar 19, 2013 3:39 pm

Re: Reading metadata from java plugin

Postby bramalingam » Tue Dec 08, 2015 1:58 pm

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
User avatar
bramalingam
 
Posts: 70
Joined: Tue Jan 14, 2014 12:01 pm

Re: Reading metadata from java plugin

Postby phm » Tue Dec 08, 2015 3:58 pm

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
phm
 
Posts: 185
Joined: Tue Mar 19, 2013 3:39 pm


Return to User Discussion [Legacy]

Who is online

Users browsing this forum: Google [Bot] and 1 guest