def rotate_img_m90(self): """ Rotates the image by -90 degree and updates the background accordingly (does not effect absorption correction). The transformation is saved and applied to every new image and background image loaded. Notifies observers. """ self._img_data = rotate_matrix_m90(self._img_data) if self._background_data is not None: self._background_data = rotate_matrix_m90(self._background_data) self.img_transformations.append(rotate_matrix_m90) self._calculate_img_data() self.notify()
def reset_img_transformations(self): """ Reverts all image transformations and resets the transformation stack. Notifies observers. """ for transformation in reversed(self.img_transformations): if transformation == rotate_matrix_p90: self._img_data = rotate_matrix_m90(self._img_data) if self._background_data is not None: self._background_data = rotate_matrix_m90(self._background_data) elif transformation == rotate_matrix_m90: self._img_data = rotate_matrix_p90(self._img_data) if self._background_data is not None: self._background_data = rotate_matrix_p90(self._background_data) else: self._img_data = transformation(self._img_data) if self._background_data is not None: self._background_data = transformation(self._background_data) self.img_transformations = [] self._calculate_img_data() self.notify()