-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Add support for itk.PointBasedSpatialObject's
- Loading branch information
Showing
5 changed files
with
163 additions
and
27 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
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,113 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Install dependencies for this example\n", | ||
"# Note: This does not include itkwidgets, itself\n", | ||
"import sys\n", | ||
"!{sys.executable} -m pip install itk-io" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from urllib.request import urlretrieve\n", | ||
"import os\n", | ||
"\n", | ||
"import itk\n", | ||
"\n", | ||
"from itkwidgets import view" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Example data from ITKTubeTK: https://github.com/KitwareMedical/ITKTubeTK\n", | ||
"\n", | ||
"tubes_file = \"Normal071-VascularNetwork.tre\"\n", | ||
"if not os.path.exists(tubes_file):\n", | ||
" url = 'https://data.kitware.com/api/v1/item/5e1b3727af2e2eed35f5c48a/download'\n", | ||
" urlretrieve(url, tubes_file)\n", | ||
" \n", | ||
"mra_file = \"Normal071-MRA.mha\"\n", | ||
"if not os.path.exists(mra_file):\n", | ||
" url = 'https://data.kitware.com/api/v1/item/5e1b3721af2e2eed35f5c482/download'\n", | ||
" urlretrieve(url, mra_file)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"PixelType = itk.F\n", | ||
"Dimension = 3\n", | ||
" \n", | ||
"# Read tre file\n", | ||
"tubesReader = itk.SpatialObjectReader[Dimension].New()\n", | ||
"tubesReader.SetFileName(tubes_file)\n", | ||
"tubesReader.Update()\n", | ||
"tubes = tubesReader.GetGroup()\n", | ||
"\n", | ||
"# Read mra image\n", | ||
"mra = itk.imread(mra_file, PixelType)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"application/vnd.jupyter.widget-view+json": { | ||
"model_id": "0f0c8f7c10aa406e9a1f19a63a6f21ce", | ||
"version_major": 2, | ||
"version_minor": 0 | ||
}, | ||
"text/plain": [ | ||
"Viewer(geometries=[], gradient_opacity=0.22, point_set_colors=array([[0.8392157, 0. , 0. ]], dtype…" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"view(point_sets=tubes)" | ||
] | ||
} | ||
], | ||
"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.6.8" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
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