We're Hiring!

Retrieving point names metadata from .nd2 files

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.

Retrieving point names metadata from .nd2 files

Postby Michaelb » Wed Sep 13, 2017 9:22 pm

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
Attachments
nis_elements_image_fields_experiment2.jpg
nis_elements_image_fields_experiment2.jpg (92.8 KiB) Viewed 4483 times
Michaelb
 
Posts: 3
Joined: Wed Sep 13, 2017 1:41 pm

Re: Retrieving point names metadata from .nd2 files

Postby dgault » Thu Sep 14, 2017 1:37 pm

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
User avatar
dgault
Team Member
 
Posts: 208
Joined: Fri Aug 14, 2015 2:56 pm

Re: Retrieving point names metadata from .nd2 files

Postby Michaelb » Sun Sep 17, 2017 3:05 pm

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
Michaelb
 
Posts: 3
Joined: Wed Sep 13, 2017 1:41 pm

Re: Retrieving point names metadata from .nd2 files

Postby dgault » Tue Sep 19, 2017 2:46 pm

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
User avatar
dgault
Team Member
 
Posts: 208
Joined: Fri Aug 14, 2015 2:56 pm

Re: Retrieving point names metadata from .nd2 files

Postby Michaelb » Sat Sep 23, 2017 12:54 pm

Thanks David,
Would I be able to know when the developers had come up with a fix?
Michaelb
 
Posts: 3
Joined: Wed Sep 13, 2017 1:41 pm

Re: Retrieving point names metadata from .nd2 files

Postby dgault » Mon Sep 25, 2017 11:44 am

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
User avatar
dgault
Team Member
 
Posts: 208
Joined: Fri Aug 14, 2015 2:56 pm

Re: Retrieving point names metadata from .nd2 files

Postby dgault » Fri Nov 24, 2017 3:18 pm

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
User avatar
dgault
Team Member
 
Posts: 208
Joined: Fri Aug 14, 2015 2:56 pm


Return to User Discussion [Legacy]

Who is online

Users browsing this forum: No registered users and 0 guests