diff --git a/nion/instrumentation/MultiAcquire.py b/nion/instrumentation/MultiAcquire.py index ae0efce..59597e3 100755 --- a/nion/instrumentation/MultiAcquire.py +++ b/nion/instrumentation/MultiAcquire.py @@ -690,7 +690,8 @@ def run(self, number_frames: int) -> None: synchronized_scan_data_stream = scan_base.make_synchronized_scan_data_stream( scan_hardware_source=self.__scan_hardware_source, scan_frame_parameters=copy.copy(self.scan_frame_parameters), - camera_hardware_source=self.__camera_hardware_source, camera_frame_parameters=camera_frame_parameters) + camera_hardware_source=self.__camera_hardware_source, camera_frame_parameters=camera_frame_parameters, + old_move_axis=True) synchronized_scan_data_stream = camera_base.ChannelDataStream( synchronized_scan_data_stream, self.camera_data_channel, Acquisition.Channel(self.__camera_hardware_source.hardware_source_id)) diff --git a/nion/instrumentation/scan_base.py b/nion/instrumentation/scan_base.py index b827de9..6bb554a 100755 --- a/nion/instrumentation/scan_base.py +++ b/nion/instrumentation/scan_base.py @@ -2489,7 +2489,8 @@ def make_synchronized_scan_data_stream( enable_drift_tracker: bool = False, drift_rotation: float = 0.0, fov_nm_model: typing.Optional[Model.PropertyModel[float]] = None, - rotation_model: typing.Optional[Model.PropertyModel[float]] = None) -> Acquisition.DataStream: + rotation_model: typing.Optional[Model.PropertyModel[float]] = None, + old_move_axis: bool = False) -> Acquisition.DataStream: # there are two separate drift corrector possibilities: # 1 - a drift corrector that takes a separate scan, implemented using the scan_data_stream_functor @@ -2548,6 +2549,11 @@ def make_synchronized_scan_data_stream( collectors.append(Acquisition.CollectedDataStream(combined_data_stream, (stop - start, scan_size.width), get_scan_calibrations(scan_frame_parameters))) # stack the sections together collector: Acquisition.DataStream = Acquisition.StackedDataStream(collectors) + if not old_move_axis and camera_frame_parameters.processing == "sum_masked": + active_masks = camera_frame_parameters.active_masks + if active_masks and len(active_masks) > 1: + collector = Acquisition.FramedDataStream(collector, operator=Acquisition.MoveAxisDataStreamOperator( + processed_camera_data_stream.channels[0])) # SynchronizedDataStream saves and restores the scan parameters; also enters/exits synchronized state collector = SynchronizedDataStream(collector, scan_hardware_source, camera_hardware_source, section_count) if scan_count > 1: diff --git a/nion/instrumentation/test/SynchronizedAcquisition_test.py b/nion/instrumentation/test/SynchronizedAcquisition_test.py index bacb707..f7e9154 100644 --- a/nion/instrumentation/test/SynchronizedAcquisition_test.py +++ b/nion/instrumentation/test/SynchronizedAcquisition_test.py @@ -301,7 +301,7 @@ def test_grab_synchronized_sum_masked_produces_data_of_correct_shape(self): si_data_item = data_item break self.assertIsNotNone(si_data_item) - self.assertEqual((4, 5, 3), si_data_item.data_shape) + self.assertEqual((3, 4, 5), si_data_item.data_shape) def test_grab_rotated_synchronized_eels(self): # tests whether rotation was applied, as judged by the resulting metadata @@ -1174,8 +1174,8 @@ def test_scan_acquisition_controller_sum_masked(self): break self.assertIsNotNone(si_data_item) if len(masks) > 1: - self.assertEqual(2, si_data_item.collection_dimension_count) - self.assertEqual((4, 4, len(masks)), si_data_item.data_shape) + self.assertEqual(si_data_item.collection_dimension_count, 1) + self.assertEqual((len(masks), 4, 4), si_data_item.data_shape) else: self.assertEqual(si_data_item.collection_dimension_count, 0) self.assertEqual((4, 4), si_data_item.data_shape)