tlambert03 / nd2

Full-featured nd2 (Nikon NIS Elements) file reader for python. Outputs to numpy, dask, and xarray. Exhaustive metadata extraction
https://tlambert03.github.io/nd2
BSD 3-Clause "New" or "Revised" License
53 stars 15 forks source link

cannot find metadata #105

Closed DanBushey closed 1 year ago

DanBushey commented 1 year ago

Description

I am searching for metadata but cannot find it. I know the metadata exists because when using NIS elements software I can export as an excel file: https://hhmionline-my.sharepoint.com/:x:/g/personal/busheyd_hhmi_org/EdGxdrwO_o9Ml1m3M6NS7WsBxXaAv2Ej9y7Ra-dwyFPR-g?e=aycWd2 I am specifically looking for data in sheet "Recorded Data" column 640 nm[%].

The nd2 file can be found here (large file 18.6 GB): https://hhmionline-my.sharepoint.com/:u:/g/personal/busheyd_hhmi_org/ESt_jvLHeMVIhiXF3VAk4aYB0NZYxLe3HT4OVH6T8s_iZA?e=zwHEbt

What I Did

I've looked in (f= nd2.ND2File(target_file)): f.frame_metadata(0) #looking at first frame. Assuming the 640 nm would be here per frame in time series image. Also, I looked in other places but do not indicate per frame state: f.custom_data - can see 640 nm as tag 6 f.attributes f.experiment f.unstructured_metadata() #when running this it hangs f.metadata

Assistance is greatly appreciated. Although I can export the data via elements it takes a long time. Thanks for nd2

tlambert03 commented 1 year ago

thanks for the detailed report and data. being addressed in #107

tlambert03 commented 1 year ago

after the next release (coming today) you'll be able to access this at f.recorded_data. It will be a dict of numpy arrays or sequences, and is suitable for passing to pandas dataframe.

f = nd2.ND2File('some_file.nd2)
df = pd.DataFrame(f.recorded_data)

or... to just get at the column you wanted:

f.recorded_data['640 nm [%]']
DanBushey commented 1 year ago

Thank you so much. With the upgrade to 0.5.0 it works great. Also, pulling the timestamp from recorded_data is much faster.