Skip to content

Commit

Permalink
Added integer handling to default get_frames method
Browse files Browse the repository at this point in the history
  • Loading branch information
pauladkisson authored Jan 30, 2024
1 parent cfcc121 commit ea67c66
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/roiextractors/imagingextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def get_frames(self, frame_idxs: ArrayType, channel: Optional[int] = 0) -> np.nd
frames: numpy.ndarray
The video frames.
"""
if isinstance(frame_idxs, int):
frame_idxs = [frame_idxs]
assert max(frame_idxs) <= self.get_num_frames(), "'frame_idxs' exceed number of frames"
if np.all(np.diff(frame_idxs) == 0):
return self.get_video(start_frame=frame_idxs[0], end_frame=frame_idxs[-1])
Expand Down

0 comments on commit ea67c66

Please sign in to comment.