Skip to content

Commit

Permalink
FEAT: implemented get_frame_without_coordinates in frame_reader
Browse files Browse the repository at this point in the history
  • Loading branch information
sander-willems-bruker committed Sep 18, 2024
1 parent e122148 commit a2e4820
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/io/readers/frame_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl FrameReader {

pub fn get(&self, index: usize) -> Result<Frame, FrameReaderError> {
// NOTE: get does it by 0-offsetting the vec, not by Frame index!!!
let mut frame = self.frames[index].clone();
let mut frame = self.get_frame_without_coordinates(index)?;
let offset = self.offsets[index];
let blob = self.tdf_bin_reader.get(offset)?;
let scan_count: usize =
Expand All @@ -130,6 +130,18 @@ impl FrameReader {
Ok(frame)
}

pub fn get_frame_without_coordinates(
&self,
index: usize,
) -> Result<Frame, FrameReaderError> {
let frame = self
.frames
.get(index)
.ok_or(FrameReaderError::IndexOutOfBounds)?
.clone();
Ok(frame)
}

pub fn get_all(&self) -> Vec<Result<Frame, FrameReaderError>> {
self.parallel_filter(|_| true).collect()
}
Expand Down Expand Up @@ -249,4 +261,6 @@ pub enum FrameReaderError {
CorruptFrame,
#[error("{0}")]
QuadrupoleSettingsReaderError(#[from] QuadrupoleSettingsReaderError),
#[error("Index out of bounds")]
IndexOutOfBounds,
}

0 comments on commit a2e4820

Please sign in to comment.