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

Add better time-stamp extraction #14

Closed tlambert03 closed 1 year ago

tlambert03 commented 2 years ago

Time stamp info is currently scattered in different places depending on the nd2 version.

While there is some information on time loop interval in reader.experiment

the actual timestamp for newer files timestamps for each frame is at

channels = nd2file._rdr._frame_metadata(i).get('channels')
timestamp = channels[0]['time']['relativeTimeMs']

for legacy readers, it's likely at

nd2file._rdr._get_xml_dict(b"VIMD", n).get('TimeMSec')  # where n is the frame number

this should be unified for the public API

tlambert03 commented 1 year ago

ND2File.events() is likely the best timestamp info now