Page 1 of 1

Retrieving point names metadata from .nd2 files

PostPosted: Wed Sep 13, 2017 9:22 pm
by Michaelb
Hi,
I have .nd2 files which are created using an NIS elements software from images of a Nikon microscope. I need to retrieve the metadata inside this files inside a code using a Java library. I tried using bio-formats library for Java and have delved into many of the methods available, but could not find a way to get the point names.
I tried using ImageJ with the bioformats-package.jar. There is an option there to get metadata, but unfortunately it doesn't include point names. The same is true with the bio-formats command-line tool.
This data is in fact in the raw file and can (barely) be seen in binary mode. I can get it in a very orderly manner with the NIS elements software, but it is not open source and there are no plugins to embed it in any code.
I'm attaching to this thread the output of NIS elements from the image properties menu. Note the point name field in the Multipoint Loop with the values: Nau, RlhA, RlhI, IASb - these I'm trying to get programmatically.

Thanks,
Michael

Re: Retrieving point names metadata from .nd2 files

PostPosted: Thu Sep 14, 2017 1:37 pm
by dgault
Hi Michael,

I have taken a look at some of our sample files but I haven't been able to locate one with this particular field. To retrieve the value in Java you will likely find it stored in the GlobalMetadata, without knowing the exact field name the below code is an example of how to read and print out all of the fields stored in global metadata:

Code: Select all
   
    Hashtable<String, Object> meta = reader.getGlobalMetadata();
    String[] keys = MetadataTools.keys(meta);
    for (String key : keys) {
      LOGGER.info("{}: {}", key,  meta.get(key));
    }


If you prefer using ImageJ with the Bio-Formats plugin then you should be able to find the metadata under Image -> Show Info. To retrieve the value programatically you could use a macro which would be similar to below but replacing the metadata field name with that displayed in the Image Info window.

Code: Select all
run("Bio-Formats Macro Extensions");
id = File.openDialog("Choose a file");
Ext.setId(id);
Ext.getMetadataValue("CH2ChannelDyeName", value);
print("Metadata = " + value);
Ext.close();


If you have a small sample file you can upload it to https://www.openmicroscopy.org/qa2/qa/upload/ and I will be able to help provide the exact commands you need.

David Gault

Re: Retrieving point names metadata from .nd2 files

PostPosted: Sun Sep 17, 2017 3:05 pm
by Michaelb
Thanks for the reply David,
I have tried accessing GlobalMetadata like you said. It was full of data but no mention of the point names Nau, RlhA, etc. Anyway I have uploaded that .nd2 file. I'd be glad if you can take a look.

Thanks,
Michael

Re: Retrieving point names metadata from .nd2 files

PostPosted: Tue Sep 19, 2017 2:46 pm
by dgault
Thank you Michael, I have been able to test the uploaded file and you are indeed correct that the point names do not appear to be stored on the global metadata. This looks like a bug as those values should be able to be stored. I have opened a Trello card to investigate this further https://trello.com/c/obHnFk58/188-nd2-m ... me-missing

David

Re: Retrieving point names metadata from .nd2 files

PostPosted: Sat Sep 23, 2017 12:54 pm
by Michaelb
Thanks David,
Would I be able to know when the developers had come up with a fix?

Re: Retrieving point names metadata from .nd2 files

PostPosted: Mon Sep 25, 2017 11:44 am
by dgault
We will ensure to update this thread once a fix is released. For details on releases the announcements are made through the mailing list or on the website announcements section. If you wish to track the issue in more detail you can sign up with Trello and subscribe to the card for notifications of any updates to it: https://trello.com/c/obHnFk58/188-nd2-m ... me-missing

David

Re: Retrieving point names metadata from .nd2 files

PostPosted: Fri Nov 24, 2017 3:18 pm
by dgault
As a follow up to this thread, a PR aiming to resolve this issue has now been opened and will be reviewed and tested.

https://github.com/openmicroscopy/bioformats/pull/3009

David Gault