-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #437 from widgetti/feat_clip_volume
feat: allow clipping of volumetric renderings
- Loading branch information
Showing
15 changed files
with
134 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "580c6579", | ||
"metadata": {}, | ||
"source": [ | ||
"# Clipping of volume\n", | ||
"\n", | ||
"In order to inspect volumetric renderings, it may be useful to remove parts of it. Using the `clip_x_min`, `clip_x_max`, `clip_y_min`, `clip_y_max`, `clip_z_min` and `clip_z_max` traits, we can control which part of the volume is rendered. In the example below you can use the sliders labels 'xmin' and 'xmax' to inspect regions inside the volume." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "c7e47337", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import ipyvolume as ipv\n", | ||
"fig = ipv.figure()\n", | ||
"volume = ipv.examples.head(show=False, description=\"Patient X\")\n", | ||
"ipv.show()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "34ea1395", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import ipywidgets as w\n", | ||
"clip_min = w.IntSlider(description=\"xmin\", min=0, max=128, value=50)\n", | ||
"clip_max = w.IntSlider(description=\"xmax\", min=0, max=128, value=100)\n", | ||
"w.jslink((clip_min, 'value'), (volume, 'clip_x_min'))\n", | ||
"w.jslink((clip_max, 'value'), (volume, 'clip_x_max'))\n", | ||
"container = ipv.gcc()\n", | ||
"container.children = container.children + [clip_min, clip_max]\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "81702c3d", | ||
"metadata": {}, | ||
"source": [ | ||
"Note that you can also link the instance the `slice_x` trait of the figure to the `clip_x_max` trait. Now we can hold the shift key and the clip plane will follow the mouse cursor." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "68b54115", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"w.jslink((fig, 'slice_x'), (volume, 'clip_x_max'));" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "22f48b7f", | ||
"metadata": {}, | ||
"source": [ | ||
"[screencapture](screenshot/volume-clip.gif)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.16" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-28 Bytes
(100%)
ui-tests/reference-output/screenshots/lighting_ipynb_cell_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-28 Bytes
(100%)
ui-tests/reference-output/screenshots/lighting_ipynb_cell_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-22 Bytes
(100%)
ui-tests/reference-output/screenshots/lighting_ipynb_cell_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-12 Bytes
(100%)
ui-tests/reference-output/screenshots/lighting_ipynb_cell_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-8 Bytes
(100%)
ui-tests/reference-output/screenshots/lighting_ipynb_cell_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
ui-tests/reference-output/screenshots/lighting_ipynb_cell_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-4 Bytes
(100%)
ui-tests/reference-output/screenshots/lighting_ipynb_cell_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-5 Bytes
(100%)
ui-tests/reference-output/screenshots/scatter_ipynb_cell_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.