From 3759fe032d35cb1de296109e194ac5d1b61edb97 Mon Sep 17 00:00:00 2001 From: Alexander Clausen Date: Wed, 24 Jul 2024 14:53:53 +0200 Subject: [PATCH] Add convenience `nav_shape` method to QdAcquisitionHeader --- libertem_qd_mpx/src/base_types.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libertem_qd_mpx/src/base_types.rs b/libertem_qd_mpx/src/base_types.rs index a2417841..3e7a0fd5 100644 --- a/libertem_qd_mpx/src/base_types.rs +++ b/libertem_qd_mpx/src/base_types.rs @@ -501,6 +501,13 @@ impl QdAcquisitionHeader { fn frames_per_trigger(&self) -> usize { self.frames_per_trigger } + + fn nav_shape(&self) -> Option<(usize, usize)> { + if let (Some(scan_x), Some(scan_y)) = (self.scan_x, self.scan_y) { + return Some((scan_y, scan_x)); + } + None + } } fn get_key_and_parse( @@ -894,6 +901,8 @@ End assert_eq!(header.num_frames(), 580); assert_eq!(header.get_scan_x(), Some(28)); assert_eq!(header.get_scan_y(), Some(20)); + + assert_eq!(header.nav_shape(), Some((20, 28))); } #[test]