-
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.
feat: allow clipping of volumetric renderings
- Loading branch information
1 parent
0740fc6
commit 28cb92d
Showing
6 changed files
with
112 additions
and
11 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,72 @@ | ||
{ | ||
"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 `x_min`, `x_max`, `y_min`, `y_max`, `z_min` and `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": "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