Skip to content

Commit

Permalink
multi-view example notebook: don't prune registration edges and perfo…
Browse files Browse the repository at this point in the history
…rm affine registration
  • Loading branch information
m-albert committed Sep 4, 2024
1 parent 359c013 commit e93af95
Showing 1 changed file with 34 additions and 13 deletions.
47 changes: 34 additions & 13 deletions notebooks/stitching_multi_view.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"%matplotlib notebook\n",
"\n",
"# the package napari-stitcher is required for visualization with napari\n",
"VISUALIZE_USING_NAPARI = False\n",
"VISUALIZE_USING_NAPARI = True\n",
"\n",
"if VISUALIZE_USING_NAPARI:\n",
" import napari\n",
Expand Down Expand Up @@ -188,21 +188,48 @@
"metadata": {},
"outputs": [],
"source": [
"# import skimage.registration\n",
"registration.register?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from multiview_stitcher import registration\n",
"\n",
"with dask.diagnostics.ProgressBar():\n",
"\n",
" # phase shift registration\n",
" params = registration.register(\n",
" # [msi_utils.get_sim_from_msim(msim) for msim in msims],\n",
" msims,\n",
" registration_binning={'z': 2, 'y': 8, 'x': 8},\n",
" reg_channel_index=0,\n",
" transform_key='affine_manual',\n",
" new_transform_key='translation_registered',\n",
" pre_registration_pruning_method=None,\n",
" groupwise_resolution_kwargs={\n",
" 'transform': 'translation',\n",
" }\n",
" )\n",
" \n",
"for msim, param in zip(msims, params):\n",
" msi_utils.set_affine_transform(msim, param, transform_key='affine_registered', base_transform_key='affine_manual')"
"\n",
" # affine registration\n",
" params = registration.register(\n",
" msims,\n",
" registration_binning={'z': 2, 'y': 8, 'x': 8},\n",
" reg_channel_index=0,\n",
" transform_key='translation_registered',\n",
" new_transform_key='affine_registered',\n",
" pre_registration_pruning_method=None,\n",
" pairwise_reg_func=registration.registration_ANTsPy,\n",
" pairwise_reg_func_kwargs={\n",
" 'transform_types': ['Rigid', 'Affine'],\n",
" },\n",
" groupwise_resolution_kwargs={\n",
" 'transform': 'affine',\n",
" }\n",
" )"
]
},
{
Expand All @@ -223,16 +250,10 @@
" viewer = napari.Viewer(ndisplay=3)\n",
"\n",
" lds = viewer_utils.create_image_layer_tuples_from_msims(\n",
" msims, transform_key='affine_manual', n_colors=4,\n",
" name_prefix='pre-registered view',\n",
" contrast_limits=[0, 1000],\n",
" )\n",
" mlayers = viewer_utils.add_image_layer_tuples_to_viewer(viewer, lds, do_link_layers=True)\n",
"\n",
" lds = viewer_utils.create_image_layer_tuples_from_msims(\n",
" msims, transform_key='affine_registered', n_colors=4,\n",
" name_prefix='registered view',\n",
" contrast_limits=[0, 1000],\n",
" positional_cmaps=False,\n",
" )\n",
" rlayers = viewer_utils.add_image_layer_tuples_to_viewer(viewer, lds, do_link_layers=True)"
]
Expand Down

0 comments on commit e93af95

Please sign in to comment.