Open-Science-Tools / nd2reader

Pure Python library for reading NIS Elements ND2 images and metadata
http://www.lighthacking.nl/nd2reader
GNU General Public License v3.0
46 stars 29 forks source link

Parsing point name in nd2 #26

Open hftsai opened 5 years ago

hftsai commented 5 years ago

Hi Great tools you have created here I'm a python novice, but I'm currently thinking to automate my experiment process.

We are conducting high throughput experiments with nikon microscopes one way to annotate experiments during a ND acqusitions is to rename the point name (as screen shot attached)

Is there a function in nd2reader to parse the point name in a multipoint loop?

image

Thanks! Best,

rbnvrw commented 5 years ago

Thanks @hftsai, I'm not sure if these point names are parsed at this moment, but you can have a look in the attributes in reader.parser._raw_metadata (where reader is your ND2Reader instance). For example maybe the attributes custom_data, image_attributes, image_metadata_sequence or image_metadata may contain the information (no guarantees though).

Let me know if you find something!

hftsai commented 5 years ago

Thank you! it doesn't seem to be in the raw_metadata or in the metadata.

I'll look into the Nikon SDK

Thanks!

aknckaan commented 3 years ago

I was having the same issue then I noticed that the point names are saved at reader.parser_raw_metadata.image_metadata['SLxExperiment']["uLoopPars"]["Points"]

rbnvrw commented 3 years ago

Great that you found this. The discoverability of all these attributes is quite low at this point. It is basically an almost one-to-one mapping of the ND2 file format into the raw metadata class. It would be great if we can improve this in future versions. I'll leave this open as a reminder.

kevinjohncutler commented 2 years ago

I would find this enhancement extremely useful - filtering data by point name is something I do regularly. Until then, @aknckaan's comment is workable. One thing I had to contend with is that reader.parser._raw_metadata.image_metadata gives byte objects, not strings, as the keys and values. One can recursively convert or just deal with typing b'Points' etc., but unless I'm just being stupid, an accessible version of this data would be in str form.