diff --git a/src/droplet_growth/poisson.py b/src/droplet_growth/poisson.py index 71cf0114d264f0624af72020705ab650b790326e..17aba4fed48a3b6eda8be5a74e4b96353a909aaa 100644 --- a/src/droplet_growth/poisson.py +++ b/src/droplet_growth/poisson.py @@ -25,5 +25,5 @@ def fit(numbers:np.ndarray, max_value=None, xlabel='Initial number of cells', print(f'Save histogram {save_fig_path}') except Exception as e: print('saving histogram failed', e.args) - # plt.show() + plt.close() return l diff --git a/src/droplet_growth/register.py b/src/droplet_growth/register.py index 6d2d927b4468838b5db6c7e2af393c9f93a3c45e..a3d9b630d303b82faf50ce1f0e1ae45d4a640e65 100644 --- a/src/droplet_growth/register.py +++ b/src/droplet_growth/register.py @@ -44,7 +44,6 @@ def align_stack(data_or_path, template16, mask2, plot=False, path_to_save=None, print(path, stack.shape) else: assert data_or_path.ndim == 3 and data_or_path.shape[0] == 2 - assert path_to_save is not None, "Please provide the path to save the data" stack = data_or_path print(f'Aligned stack will be saved to {path_to_save}') @@ -55,7 +54,7 @@ def align_stack(data_or_path, template16, mask2, plot=False, path_to_save=None, stack_mask_scale = binnings[2] // binnings[0] f_bf = bf[::stack_temp_scale, ::stack_temp_scale] - + f_bf_sm = ndi.gaussian_filter(f_bf, 2) # f_bf = filter_by_fft( # bf[::stack_temp_scale, ::stack_temp_scale], # sigma=40, @@ -63,7 +62,7 @@ def align_stack(data_or_path, template16, mask2, plot=False, path_to_save=None, # fix_vertical_stripes=True, # highpass=True # ) - tvec8 = get_transform(f_bf, template16, plot=plot) + tvec8 = get_transform(f_bf_sm, template16, plot=plot) plt.show() tvec = scale_tvec(tvec8, mask_temp_scale) print(tvec) @@ -89,7 +88,8 @@ def align_stack(data_or_path, template16, mask2, plot=False, path_to_save=None, aligned_stack = np.stack((aligned_bf, aligned_tritc, mask2)).astype('uint16') - imwrite(path_to_save, aligned_stack, imagej=True, metadata=META_ALIGNED) + if path_to_save is not None: + imwrite(path_to_save, aligned_stack, imagej=True, metadata=META_ALIGNED) print(f'Saved aligned stack {path_to_save}') return aligned_stack, tvec