Skip to content

Instantly share code, notes, and snippets.

@thewtex
Created June 21, 2020 03:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thewtex/d5caa6a4b2c2de6bc0e62aebf1206ee7 to your computer and use it in GitHub Desktop.
Save thewtex/d5caa6a4b2c2de6bc0e62aebf1206ee7 to your computer and use it in GitHub Desktop.
X/Y/Z anisotropic voxel scaling possible with the itkwidgets.view function?
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import itk\n",
"import imageio\n",
"\n",
"from itkwidgets import view"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# Reads in metdata into the image data structure\n",
"image = imageio.volread('000200.raw.tif')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"image = itk.image_view_from_array(image)\n",
"image.SetSpacing([0.52,0.52,1.98])"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3b9ab9373610414ab099d4c7f721183a",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Viewer(geometries=[], gradient_opacity=0.6, point_sets=[], rendered_image=<itk.itkImagePython.itkImageUS3; pro…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"view(image, gradient_opacity=0.6, rotate=True, ui_collapsed=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment