From 109ae09c646739833dca4ca99a625e0308a0f507 Mon Sep 17 00:00:00 2001 From: Andrey Aristov <aaristov@pasteur.fr> Date: Wed, 5 Apr 2023 15:16:04 +0200 Subject: [PATCH] tighten constraints --- src/droplet_growth/register.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/droplet_growth/register.py b/src/droplet_growth/register.py index 0203af9..e7096cd 100644 --- a/src/droplet_growth/register.py +++ b/src/droplet_growth/register.py @@ -25,6 +25,13 @@ META_ALIGNED = {'ImageJ': '1.53c', 'LUTs': [grey, green, blue] } +constraints={ + "scale": [1, 0.1], + "tx": [0, 150], + "ty": [0, 150], + "angle": [0, 10], +} + def align_stack(data_or_path, template16, mask2, plot=False, path_to_save=None, binnings=(1,16,2), suffix='.aligned.tif'): ''' stack should contain two channels: bright field and fluorescence. @@ -94,7 +101,7 @@ def align_stack(data_or_path, template16, mask2, plot=False, path_to_save=None, return aligned_stack, tvec -def align_stack_nd(stack, template16, mask2, path=None, plot=False, binnings=(1,16,2), suffix='.aligned.tif') -> tuple(np.ndarray, dict): +def align_stack_nd(stack, template16, mask2, path=None, plot=False, binnings=(1,16,2), suffix='.aligned.tif'): ''' stack should contain two channels: bright field and fluorescence. BF will be binned 8 times and registered with template8 (aligned BF). @@ -279,7 +286,7 @@ def register(image, template): ''' assert np.array_equal(image.shape, template.shape), \ f'unequal shapes {(image.shape, template.shape)}' - return reg.similarity(template, image, constraints={'scale': [1,0.2], 'tx': [0, 500], 'ty': [0, 500], 'angle': [0, 30]}) + return reg.similarity(template, image, constraints=constraints) def filter_by_fft( -- GitLab