diff --git a/examples/integrations/itk/SelectROI.ipynb b/examples/integrations/itk/SelectROI.ipynb
index dfed7005..d3be461c 100644
--- a/examples/integrations/itk/SelectROI.ipynb
+++ b/examples/integrations/itk/SelectROI.ipynb
@@ -45,7 +45,7 @@
"source": [
"import itk\n",
"import pooch\n",
- "from ngff_zarr import to_multiscales, itk_image_to_ngff_image, to_ngff_image, Methods\n",
+ "from ngff_zarr import to_multiscales, ngff_image_to_itk_image, Methods\n",
"from itkwidgets import view"
]
},
@@ -71,9 +71,7 @@
},
"outputs": [],
"source": [
- "image = itk.imread(file_name)\n",
- "ngff_image = itk_image_to_ngff_image(image)\n",
- "multiscales = to_multiscales(ngff_image, method=Methods.DASK_IMAGE_GAUSSIAN)"
+ "image = itk.imread(file_name)"
]
},
{
@@ -87,11 +85,11 @@
"data": {
"text/html": [
"\n",
- " \n",
+ " \n",
" \n",
@@ -119,7 +117,7 @@
{
"data": {
"text/html": [
- "
"
+ ""
],
"text/plain": [
""
@@ -130,7 +128,7 @@
}
],
"source": [
- "viewer = view(multiscales)"
+ "viewer = view(image)"
]
},
{
@@ -198,7 +196,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "#### The ROI region will return the physical, world coordinates for the selection"
+ "#### By default the information for the current scale is returned when requesting the ROI slices. You can also pass a value in to explicitly request a scale."
]
},
{
@@ -211,8 +209,17 @@
},
"outputs": [],
"source": [
- "# Get the selected region for the current level\n",
- "roi_region = viewer.get_roi_region()"
+ "# Request the slice information for the ROI\n",
+ "default_roi_slices = viewer.get_roi_slice()\n",
+ "roi_slices = viewer.get_roi_slice(loaded_scale)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#### The results should match!\n",
+ "#### *Note*: The data is streamed in in chunks and the current resolution will improve as each scale becomes available. If you find that the slices do not match check the currently loaded scale (either programmatically or with the UI) - it may have improved since you last checked!"
]
},
{
@@ -225,26 +232,18 @@
},
"outputs": [
{
- "data": {
- "text/plain": [
- "[{'x': 23.396325695015783, 'y': -6.971699953079224, 'z': -6.971699953079224},\n",
- " {'x': 40.965580514187074, 'y': 88.71824049949645, 'z': 61.378257513046265}]"
- ]
- },
- "execution_count": 9,
- "metadata": {},
- "output_type": "execute_result"
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Slices for loaded scale: (slice(0, 250, None), slice(0, 350, None), slice(120, 173, None))\n",
+ "Slices with default parameter: (slice(0, 250, None), slice(0, 350, None), slice(120, 173, None))\n"
+ ]
}
],
"source": [
- "roi_region"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "#### By default the information for the current scale is returned when requesting the ROI slices. You can also pass a value in to explicitly request a scale."
+ "# The results should match\n",
+ "print(f'Slices for loaded scale: {roi_slices}')\n",
+ "print(f'Slices with default parameter: {default_roi_slices}')"
]
},
{
@@ -257,17 +256,10 @@
},
"outputs": [],
"source": [
- "# Request the slice information for the ROI\n",
- "default_roi_slices = viewer.get_roi_slice()\n",
- "roi_slices = viewer.get_roi_slice(loaded_scale)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "#### The results should match!\n",
- "#### *Note*: The data is streamed in in chunks and the current resolution will improve as each scale becomes available. If you find that the slices do not match check the currently loaded scale (either programmatically or with the UI) - it may have improved since you last checked!"
+ "# Create a new viewer using only the data in the ROI determined above\n",
+ "# get_roi_image will return a dict of ngff images with the keys representing the names for each\n",
+ "# For our example we should have one entry under \"Image\"\n",
+ "roi_image = viewer.get_roi_image(loaded_scale)"
]
},
{
@@ -280,18 +272,25 @@
},
"outputs": [
{
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Slices for loaded scale: (slice(0, 250, None), slice(0, 350, None), slice(110, 176, None))\n",
- "Slices with default parameter: (slice(0, 250, None), slice(0, 350, None), slice(110, 176, None))\n"
- ]
+ "data": {
+ "text/plain": [
+ "NgffImage(data=dask.array, dims=['z', 'y', 'x'], scale={'z': 0.2734, 'y': 0.2734, 'x': 0.2734}, translation={'x': 25.973146382696534, 'y': -6.971699714660643, 'z': -6.971699953079224}, name='Image', axes_units={'z': None, 'y': None, 'x': None}, computed_callbacks=[])"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
}
],
"source": [
- "# The results should match\n",
- "print(f'Slices for loaded scale: {roi_slices}')\n",
- "print(f'Slices with default parameter: {default_roi_slices}')"
+ "roi_image"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#### The ROI region will return the physical, world coordinates for the selection"
]
},
{
@@ -304,10 +303,8 @@
},
"outputs": [],
"source": [
- "# Create a new viewer using only the data in the ROI determined above\n",
- "# get_roi_image will return a dict of ngff images with the keys representing the names for each\n",
- "# For our example we should have one entry under \"Image\"\n",
- "roi_image = viewer.get_roi_image(loaded_scale)"
+ "# Get the selected region for the current level\n",
+ "roi_region = viewer.get_roi_region()"
]
},
{
@@ -322,7 +319,8 @@
{
"data": {
"text/plain": [
- "NgffImage(data=dask.array, dims=['z', 'y', 'x'], scale={'z': 0.2734, 'y': 0.2734, 'x': 0.2734}, translation={'x': 23.396325695015783, 'y': -6.971699953079224, 'z': -6.971699953079224}, name='image', axes_units=None, computed_callbacks=[])"
+ "[{'x': 25.973146382696534, 'y': -6.971699714660643, 'z': -6.971699953079224},\n",
+ " {'x': 40.14316091031731, 'y': 88.71824073791504, 'z': 61.378257513046265}]"
]
},
"execution_count": 13,
@@ -331,7 +329,7 @@
}
],
"source": [
- "roi_image"
+ "roi_region"
]
},
{
@@ -342,6 +340,20 @@
"skip-execution"
]
},
+ "outputs": [],
+ "source": [
+ "# Create an itk image from the ngff image returned from get_roi_image\n",
+ "itk_image = ngff_image_to_itk_image(roi_image)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "tags": [
+ "skip-execution"
+ ]
+ },
"outputs": [
{
"data": {
@@ -390,21 +402,21 @@
}
],
"source": [
- "viewer2 = view(roi_image, rotate=True)"
+ "viewer2 = view(itk_image, rotate=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "Extract the region from the original image.\n",
+ "Extract the region from the original image. \n",
"\n",
- "Use physical units, which are independent of resolutions, slices."
+ "Use physical units, which are independent of resolutions, slices"
]
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": 16,
"metadata": {
"tags": [
"skip-execution"
@@ -415,11 +427,11 @@
"data": {
"text/html": [
"\n",
- " \n",
+ " \n",
" \n",
@@ -435,7 +447,7 @@
{
"data": {
"application/javascript": [
- "window.connectPlugin && window.connectPlugin(\"565ed048-79c8-419e-ac4f-86e093fe08f7\")"
+ "window.connectPlugin && window.connectPlugin(\"36aff9cb-6524-4587-8126-ab3615cdeb6f\")"
],
"text/plain": [
""
@@ -447,7 +459,7 @@
{
"data": {
"text/html": [
- ""
+ ""
],
"text/plain": [
""
@@ -466,6 +478,17 @@
"\n",
"viewer3 = view(roi_image, rotate=True)"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "tags": [
+ "skip-execution"
+ ]
+ },
+ "outputs": [],
+ "source": []
}
],
"metadata": {