|
51 | 51 | "postfix_sub = \"_sub\"\n", |
52 | 52 | "postfix_f_f0 = \"_f_f0\"\n", |
53 | 53 | "postfix_wt = \"_wt\"\n", |
| 54 | + "postfix_diff = \"_diff\"\n", |
54 | 55 | "postfix_norm = \"_norm\"\n", |
55 | 56 | "postfix_dict = \"_dict\"\n", |
56 | 57 | "postfix_post = \"_post\"\n", |
|
989 | 990 | " )" |
990 | 991 | ] |
991 | 992 | }, |
| 993 | + { |
| 994 | + "cell_type": "markdown", |
| 995 | + "metadata": {}, |
| 996 | + "source": [ |
| 997 | + "### Difference\n", |
| 998 | + "\n", |
| 999 | + "* `block_space` (`int`): extent of each spatial dimension for each block (run in parallel).\n", |
| 1000 | + "* `norm_frames` (`int`): number of frames for use during normalization of each full frame block (run in parallel)." |
| 1001 | + ] |
| 1002 | + }, |
| 1003 | + { |
| 1004 | + "cell_type": "code", |
| 1005 | + "execution_count": null, |
| 1006 | + "metadata": {}, |
| 1007 | + "outputs": [], |
| 1008 | + "source": [ |
| 1009 | + "%%time\n", |
| 1010 | + "\n", |
| 1011 | + "\n", |
| 1012 | + "block_frames = 40\n", |
| 1013 | + "norm_frames = 100\n", |
| 1014 | + "\n", |
| 1015 | + "\n", |
| 1016 | + "with get_executor(client) as executor:\n", |
| 1017 | + " dask_io_remove(data_basename + postfix_diff + zarr_ext, executor)\n", |
| 1018 | + "\n", |
| 1019 | + "\n", |
| 1020 | + " with open_zarr(data_basename + postfix_wt + zarr_ext, \"r\") as f:\n", |
| 1021 | + " # Load and prep data for computation.\n", |
| 1022 | + " imgs = f[\"images\"]\n", |
| 1023 | + " da_imgs = da.from_array(\n", |
| 1024 | + " imgs, chunks=(block_frames,) + (imgs.ndim - 1) * (block_space,)\n", |
| 1025 | + " )\n", |
| 1026 | + "\n", |
| 1027 | + " da_imgs_flt = da_imgs\n", |
| 1028 | + " if not (issubclass(da_imgs_flt.dtype.type, np.floating) and \n", |
| 1029 | + " da_imgs_flt.dtype.itemsize >= 4):\n", |
| 1030 | + " da_imgs_flt = da_imgs_flt.astype(np.float32)\n", |
| 1031 | + "\n", |
| 1032 | + " da_result = da_imgs_flt[1:] - da_imgs_flt[:-1]\n", |
| 1033 | + "\n", |
| 1034 | + " # Store denoised data\n", |
| 1035 | + " dask_store_zarr(data_basename + postfix_diff + zarr_ext, [\"images\"], [da_result], executor)\n", |
| 1036 | + "\n", |
| 1037 | + "\n", |
| 1038 | + " zip_zarr(data_basename + postfix_diff + zarr_ext, executor)\n", |
| 1039 | + "\n", |
| 1040 | + "\n", |
| 1041 | + "if __IPYTHON__:\n", |
| 1042 | + " result_image_stack = LazyZarrDataset(data_basename + postfix_diff + zarr_ext, \"images\")\n", |
| 1043 | + "\n", |
| 1044 | + " mplsv = plt.figure(FigureClass=MPLViewer)\n", |
| 1045 | + " mplsv.set_images(\n", |
| 1046 | + " result_image_stack,\n", |
| 1047 | + " vmin=par_compute_min_projection(num_frames=norm_frames)(result_image_stack).min(),\n", |
| 1048 | + " vmax=par_compute_max_projection(num_frames=norm_frames)(result_image_stack).max()\n", |
| 1049 | + " )" |
| 1050 | + ] |
| 1051 | + }, |
992 | 1052 | { |
993 | 1053 | "cell_type": "markdown", |
994 | 1054 | "metadata": {}, |
|
1015 | 1075 | " dask_io_remove(data_basename + postfix_norm + zarr_ext, executor)\n", |
1016 | 1076 | "\n", |
1017 | 1077 | "\n", |
1018 | | - " with open_zarr(data_basename + postfix_wt + zarr_ext, \"r\") as f:\n", |
| 1078 | + " with open_zarr(data_basename + postfix_diff + zarr_ext, \"r\") as f:\n", |
1019 | 1079 | " # Load and prep data for computation.\n", |
1020 | 1080 | " imgs = f[\"images\"]\n", |
1021 | 1081 | " da_imgs = da.from_array(\n", |
|
0 commit comments