Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finish time stamp #134

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions oct_converter/readers/e2e.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

import time
import warnings
from collections import defaultdict
from datetime import date, datetime, timedelta
from datetime import date
from itertools import chain
from pathlib import Path

Expand Down Expand Up @@ -145,14 +146,18 @@ def _make_lut():
elif chunk.type == 10004: # bscan metadata
raw = f.read(104)
bscan_metadata = e2e_binary.bscan_metadata.parse(raw)
start_epoch = datetime(
year=1600, month=12, day=31, hour=23, minute=59
)
acquisition_datetime = start_epoch + timedelta(
seconds=bscan_metadata.acquisitionTime * 1e-7

windowsTicks = bscan_metadata.acquisitionTime
windowsTicksToUnixFactor = 10000000
secToUnixEpechFromWindowsTicks = 11644473600
unixtime = (
windowsTicks / windowsTicksToUnixFactor
- secToUnixEpechFromWindowsTicks
)
utc_time = time.gmtime(unixtime)
utc_time_string = time.strftime("%Y-%m-%d %H:%M:%S", utc_time)
if self.acquisition_date is None:
self.acquisition_date = acquisition_datetime.date()
self.acquisition_date = utc_time_string
if self.pixel_spacing is None:
# scaley found, x and z not yet found in file
# but taken from E2E reader settings
Expand Down
Loading