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

Generalize video attribute #89

Open
eberrigan opened this issue Oct 24, 2024 · 0 comments
Open

Generalize video attribute #89

eberrigan opened this issue Oct 24, 2024 · 0 comments

Comments

@eberrigan
Copy link
Collaborator

eberrigan commented Oct 24, 2024

This should generalize to getting the video from the labels file when possible instead of just the h5 path

# Attempt to load the video, with error handling
video = None
try:
if h5_path:
# Make path object
h5_path = Path(h5_path)
# Check if the file exists
if h5_path.exists():
# Make the h5_path POSIX-compliant
h5_path = h5_path.as_posix()
# Load the video
video = sio.Video.from_filename(h5_path)
# Replace the filename in the labels with the h5_path
for labels in [primary_labels, lateral_labels, crown_labels]:
if labels is not None:
labels.video.replace_filename(h5_path)
else:
print(f"Video file not found: {h5_path}")
except Exception as e:
print(f"Error loading video file {h5_path}: {e}")

Related: plot function should accept other formats besides h5 files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant