# use bounded uni-variable optimizer to locate the tilt angle that minimize
# the dissimilarity of the 180 deg pair
res=minimize_scalar(
@@ -249,6 +259,9 @@ class tilt_correction(param.ParameterizedFunction):
cut_off_angle_deg: float
The angle in degrees to cut off the rotation axis tilt correction, i.e.
skip applying tilt correction for tilt angles that are too small.
center: Any
The center of the rotation axis, default is None, which means the center
of the image. This will be passed to the rotation function from skimage.
max_workers:
Number of cores to use for parallel median filtering, default is 0,
which means using all available cores.
@@ -275,6 +288,10 @@ class tilt_correction(param.ParameterizedFunction):
default=2.0,
doc="The angle in degrees to cut off the rotation axis tilt correction, i.e. skip applying tilt correction for tilt angles that are too small.",
)
center=param.Parameter(
default=None,
doc="The center of the rotation axis, default is None, which means the center of the image. This will be passed to the rotation function from skimage.",
)
# NOTE:
# The front and backend are sharing the same computing unit, therefore we can
# set a hard cap on the max_workers.
@@ -329,6 +346,7 @@ class tilt_correction(param.ParameterizedFunction):
calculate_tilt,
low_bound=params.low_bound,
high_bound=params.high_bound,
center=params.center,
),
[shm_arrays[il]forilinidx_lowrange],
[shm_arrays[ih]forihinidx_highrange],
@@ -349,6 +367,7 @@ class tilt_correction(param.ParameterizedFunction):
corrected_array=apply_tilt_correction(
arrays=params.arrays,
tilt=tilt,
center=params.center,
max_workers=self.max_workers,
)
returncorrected_array
@@ -366,6 +385,8 @@ class apply_tilt_correction(param.ParameterizedFunction):
The array for tilt correction
tilt: float
The rotation axis tilt angle in degrees
center: Any
The center of the rotation axis, default is None, which means the center
max_workers: int
Number of cores to use for parallel median filtering, default is 0, which means using all available cores.
tqdm_class: panel.widgets.Tqdm
@@ -379,6 +400,10 @@ class apply_tilt_correction(param.ParameterizedFunction):
arrays=param.Array(doc="The array for tilt correction",default=None)
tilt=param.Number(doc="The rotation axis tilt angle in degrees",default=None)
center=param.Parameter(
default=None,
doc="The center of the rotation axis, default is None, which means the center of the image. This will be passed to the rotation function from skimage.",
)
# NOTE:
# The front and backend are sharing the same computing unit, therefore we can
# set a hard cap on the max_workers.
@@ -406,7 +431,9 @@ class apply_tilt_correction(param.ParameterizedFunction):