diff --git a/notebook/test_nuclei_quantification.ipynb b/notebook/test_nuclei_quantification.ipynb index 84c2ae9c7e03778dfc4b63414266f3e31e2d2101..e2cbe0f67091f8bcd5f594bdd728a1c162fe4ea2 100644 --- a/notebook/test_nuclei_quantification.ipynb +++ b/notebook/test_nuclei_quantification.ipynb @@ -23,7 +23,6 @@ "\n", "import matplotlib.pyplot as plt\n", "import pyvista as pv\n", - "pv.set_jupyter_backend('ipyvtklink')\n", "\n", "from timagetk import SpatialImage\n", "from timagetk.io import imread\n", @@ -102,16 +101,14 @@ "source": [ "image_datas = {}\n", "\n", + "image_data = pv.ImageData(dimensions=img.shape[::-1], spacing=img.voxelsize[::-1])\n", "for channel_name in img.channel_names:\n", - " image_data = vtk_image_data_from_image(img[channel_name].get_array(), img.voxelsize)\n", - " image_data = pv.UniformGrid(image_data)\n", - " image_data.point_data.GetArray(0).SetName(channel_name)\n", - " image_datas[channel_name] = image_data\n", + " image_data.point_data[channel_name] = img[channel_name].get_array().ravel()\n", "\n", - "plotter = pv.Plotter(notebook=True)\n", + "plotter = pv.Plotter(notebook=False)\n", "plotter.set_background('w')\n", "\n", - "plotter.add_volume(image_datas['Cas9RFP'], cmap='Greys', clim=(0, 2000))\n", + "plotter.add_volume(image_data, scalars='Cas9RFP', cmap='Greys', clim=(0, 2000))\n", "\n", "plotter.show()" ] @@ -349,9 +346,11 @@ " for i, signal_name in enumerate(['FieGFP', 'Cas9RFP']):\n", " figure.add_subplot(1, 2, i+1)\n", "\n", - " nucleus_img = img[signal_name].get_array()[nucleus_coords[0], \n", - " nucleus_coords[1]-40:nucleus_coords[1]+40,\n", - " nucleus_coords[2]-40:nucleus_coords[2]+40]\n", + " nucleus_img = img[signal_name].get_array()[\n", + " nucleus_coords[0],\n", + " nucleus_coords[1]-nucleus_window:nucleus_coords[1]+nucleus_window,\n", + " nucleus_coords[2]-nucleus_window:nucleus_coords[2]+nucleus_window\n", + " ]\n", "\n", " figure.gca().imshow(\n", " nucleus_img,\n", @@ -388,7 +387,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.12" + "version": "3.9.18" } }, "nbformat": 4,