Commit 4fa69f53 authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[core][dataset] Add compute_transformation method to return array with the...

[core][dataset] Add compute_transformation method to return array with the corresponding axes transformation
parent 799b5b65
......@@ -46,14 +46,14 @@ from import utils
from import fabioh5
from import DataUrl
from darfix.core.dimension import AcquisitionDims, Dimension
from darfix.core.dimension import AcquisitionDims, Dimension, POSITIONER_METADATA
from darfix.core.imageOperations import img2img_mean, chunk_image
from darfix.core.imageOperations import background_subtraction, background_subtraction_2D
from darfix.core.imageOperations import hot_pixel_removal_3D, hot_pixel_removal_2D
from darfix.core.imageOperations import threshold_removal
from darfix.core.imageOperations import Method
from darfix.core.imageRegistration import shift_detection, apply_shift
from darfix.core.mapping import fit_data, compute_moments
from darfix.core.mapping import fit_data, compute_moments, compute_rsm, compute_magnification
from darfix.core.roi import apply_2D_ROI, apply_3D_ROI
from darfix.core.utils import wrapTo2pi
from darfix.decomposition.ipca import IPCA
......@@ -1259,6 +1259,21 @@ class Dataset():
data = Data(new_urls.reshape(,, in_memory=True) # to modify
return Dataset(_dir=_dir, data=data, dims=self.__dims, in_memory=True)
def compute_transformation(self, d, rotate=False):
H, W = self.get_data(0).shape
if self.dims.ndim == 1:
ffz = self.get_metadata_values(POSITIONER_METADATA, "ffz")[0]
mainx = -self.get_metadata_values(POSITIONER_METADATA, "mainx")[0]
self.transformation = compute_rsm(H, W, d, ffz, mainx)
obx = self.get_metadata_values(POSITIONER_METADATA, "obx")[0]
obpitch = self.get_metadata_values(POSITIONER_METADATA, "obpitch")
obpitch = obpitch[len(obpitch) // 2]
mainx = -self.get_metadata_values(POSITIONER_METADATA, "mainx")[0]
self.transformation = compute_magnification(H, W, d, obx, obpitch, mainx)
def __deepcopy__(self, memo):
Create copy of the dataset. The data numpy array is also copied using
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment