1

I have a series of .nd2 files from NIS Elements AR, associated with Nikon microscopes. In Elements AR custom user defined metadata can be added to images/image series and is saved in the .nd2 format. When these files are saved and then reopened in Elements AR the custom metadata is all displayed correctly

A range of python .nd2 importers exists eg. nd2, nd2reader and pims_nd2. However although these packages can extract most of the .nd2 metadata I cannot access the user defined custom metadata. Perhaps I am missing a function in these packages to access the user defined metadata (the .custom_data option in nd2 does not work)

Does anyone have any experience extracting this type of custom metadata from Nikon .nd2 files or similar proprietary microscope software?

j1ling67n
  • 55
  • 4
  • Author of nd2 here, it would be great if you could open an issue with the file at the GitHub repo. Happy to make sure you can extract whatever you need from the metadata if it’s not already working for you. Also, there have been a lot of recent updates, so you might just try it again? – tlambert Jun 28 '23 at 09:10

1 Answers1

1

I am dealing with the same issue. One work around is using an ImageJ macro to open and save metadata as txt files and then extract that data using a language like python.

Edit:

This code works:

import nd2
f = nd2.ND2File('nd2_image_path') # load image
all_metadata = f.unstructured_metadata() # Load all metadata as a dict
x_pos = all_metadata['ImageMetadataSeqLV|0']['SLxPictureMetadata']['XPos'] # Find x coordinate
y_pos = all_metadata['ImageMetadataSeqLV|0']['SLxPictureMetadata']['YPos'] # Find y coordinate
MR1000
  • 11
  • 4
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Aref Riant May 08 '23 at 04:44