diff --git a/src/droplet_growth/register.py b/src/droplet_growth/register.py index 0203af997db2912745cfbde5cbc8603f5541324e..e7096cdc3416b75ba5e07bda5dd05cd5be9dd9f1 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(