Skip to content

Commit

Permalink
Merge branch 'volumetric' into 3DScanImage_rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
pauladkisson authored Sep 29, 2023
2 parents ead321b + 4596212 commit ff9890d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/roiextractors/volumetricimagingextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,18 @@ def get_frames(self, frame_idxs: ArrayType) -> np.ndarray:
frames: numpy.ndarray
The 3D video frames (num_rows, num_columns, num_planes).
"""
squeeze_data = False
if isinstance(frame_idxs, int):
frame_idxs = [frame_idxs]
squeeze_data = True
for frame_idx in frame_idxs:
if frame_idx < -1 * self.get_num_frames() or frame_idx >= self.get_num_frames():
raise ValueError(f"frame_idx {frame_idx} is out of bounds")

# Note np.all([]) returns True so not all(np.diff(frame_idxs) == 1) returns False if frame_idxs is a single int
if not all(np.diff(frame_idxs) == 1):
frames = np.zeros((len(frame_idxs), *self.get_image_size()), self.get_dtype())
for i, imaging_extractor in enumerate(self._imaging_extractors):
frames[..., i] = imaging_extractor.get_frames(frame_idxs)
if squeeze_data:
return frames.squeeze()
else:
return frames
return frames
else:
return self.get_video(start_frame=frame_idxs[0], end_frame=frame_idxs[-1] + 1)

Expand Down

0 comments on commit ff9890d

Please sign in to comment.