105 lines (104 with data), 2.6 kB
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"id": "8e4667b0",
"metadata": {},
"outputs": [],
"source": [
"import pymskt as mskt\n",
"from pymskt.mesh import BoneMesh, CartilageMesh\n",
"import SimpleITK as sitk\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "99154fe7",
"metadata": {},
"outputs": [],
"source": [
"location_seg = '../data/right_knee_example.nrrd'"
]
},
{
"cell_type": "markdown",
"id": "a09da648",
"metadata": {},
"source": [
"To create a mesh, we must first pass a segmentation image (simpleitk) to the mesh object. This can be done in multiple ways. "
]
},
{
"cell_type": "markdown",
"id": "e7d2d9e0",
"metadata": {},
"source": [
"- Show all of the ways to assign segmentations & meshes (bone & cartilage) to the BoneMesh object"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e84de078",
"metadata": {},
"outputs": [],
"source": [
"# we can pass the location of the seg image directly to the function \n",
"# right now, this takes only single files (.nrrd, .nii.gz, .dcm (3D))\n",
"# there is currently an issue opened to allow passing a dicom folder. \n",
"# https://github.com/gattia/pymskt/issues/16\n",
"femur = BoneMesh(path_seg_image = location_seg)\n",
"\n",
"# alternatively, we can set or update the seg_image later using an actual SitkImage\n",
"seg_image = sitk.ReadImage(location_seg)\n",
"femur.seg_image = seg_image\n",
"\n",
"# or we can pass the path directly to the `Mesh.read_seg_image()` function: \n",
"femur.read_seg_image(location_seg_image)\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "6a4f13a9",
"metadata": {},
"source": [
"- Show details on how to crop bones"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5034eac3",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.12 64-bit ('imaging': conda)",
"language": "python",
"name": "python3812jvsc74a57bd06c87bace85be111efbe28079ae26f740e5c4bf58b006b66c98bd87f126cf4b07"
},
"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.8.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}