diff --git a/examples/ITK_Example_RegistrationOfPointsInMemory.ipynb b/examples/ITK_Example_RegistrationOfPointsInMemory.ipynb new file mode 100644 index 0000000..396528c --- /dev/null +++ b/examples/ITK_Example_RegistrationOfPointsInMemory.ipynb @@ -0,0 +1,189 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "f9aa2e00-18c3-4753-be93-9d7c2ef5d0b9", + "metadata": {}, + "source": [ + "## Registration of Points in memory" + ] + }, + { + "cell_type": "markdown", + "id": "2cd37425", + "metadata": {}, + "source": [ + "Demonstrates how to use the points of a pair of itk.PointSet objects as input to a registration" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "639d3356", + "metadata": {}, + "outputs": [], + "source": [ + "import itk\n", + "\n", + "# Generate the corner points of a unit square (1x1 square).\n", + "def make_square(origin_x, origin_y):\n", + " point_set = itk.PointSet[itk.UC, 2].New()\n", + " points = point_set.GetPoints().CastToSTLContainer()\n", + "\n", + " for x in (0, 1):\n", + " for y in (0, 1):\n", + " points.push_back((origin_x + x, origin_y + y))\n", + "\n", + " return point_set\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "21650338", + "metadata": {}, + "outputs": [], + "source": [ + "def plot_point_sets(point_sets):\n", + "\n", + " import matplotlib.pyplot as plt\n", + "\n", + " figure = plt.figure()\n", + " axes = plt.axes()\n", + " axes.set_xlim(0, 8)\n", + " axes.set_ylim(0, 5)\n", + "\n", + " for point_set in point_sets:\n", + " index_range = range(0, point_set.GetNumberOfPoints())\n", + " axes.scatter(\n", + " [point_set.GetPoint(i)[0] for i in index_range],\n", + " [point_set.GetPoint(i)[1] for i in index_range],\n", + " )\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "1443c475", + "metadata": {}, + "outputs": [], + "source": [ + "fixed_point_set = make_square(3, 3)\n", + "moving_point_set = make_square(6, 1)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "cddc7f71-9ba1-4291-bf6f-bb8066271e3a", + "metadata": {}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umnY+HChbFw4cJ6j5Zux44dsWjRopg5c2YcdFBNP4VQNzNmzIibb745xowZExMmTIjnnnsuvv/978ell15a3QP11ddj9saPf/zjYuzYscXBBx9cnHTSSQ3xVchHH320iIjdLjNnzqz3aGn2tN6IKBYtWlTv0VJdeumlPf99f+ADHyjOOOOM4uGHH673WHXRCF99/dKXvlSMHDmyeM973lO0trYW5513XrF27dp6j1UTDz74YDFx4sSiVCoVxx57bLFw4cJ6j1QTv/nNb4qIKF544YV6j1IzXV1dxezZs4sxY8YUgwcPLo488sji+uuvLyqVSlWP4yfmAYBUfhsFAEglNgCAVGIDAEglNgCAVGIDAEglNgCAVGIDAEglNgCAVGIDAEglNgCAVGIDAEj1v5wIStxAdxy0AAAAAElFTkSuQmCC", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "plot_point_sets((fixed_point_set, moving_point_set))" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "13553993-6753-433a-be5b-04ccff941474", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Detected translation: [ 2.98161544 -1.98774363]\n" + ] + } + ], + "source": [ + "dimension = 2\n", + "ImageType = itk.Image[itk.SS, dimension]\n", + "\n", + "dummy_image = ImageType.New()\n", + "dummy_image.SetRegions(itk.Size[dimension].Filled(8))\n", + "dummy_image.AllocateInitialized()\n", + "\n", + "parameter_object = itk.ParameterObject.New()\n", + "parameter_object.AddParameterMap(\n", + " {\"ImageSampler\": (\"Full\",),\n", + " \"MaximumNumberOfIterations\": (\"16\",),\n", + " \"Metric\": (\"AdvancedNormalizedCorrelation\", \"CorrespondingPointsEuclideanDistanceMetric\"),\n", + " \"Optimizer\": (\"AdaptiveStochasticGradientDescent\",),\n", + " \"Registration\": ( \"MultiMetricMultiResolutionRegistration\",),\n", + " \"Transform\": (\"TranslationTransform\",)})\n", + "\n", + "registration = itk.ElastixRegistrationMethod.New(\n", + " fixed_image=dummy_image,\n", + " moving_image=dummy_image,\n", + " parameter_object=parameter_object,\n", + " fixed_points=fixed_point_set.GetPoints(),\n", + " moving_points=moving_point_set.GetPoints())\n", + "registration.Update()\n", + "\n", + "transform = registration.GetNthTransform(0)\n", + "print('Detected translation: ', itk.GetArrayViewFromVnlVector(transform.GetParameters()))\n", + "\n", + "transformed_point_set = itk.PointSet[itk.UC, dimension].New()\n", + "\n", + "for i in range(0, fixed_point_set.GetNumberOfPoints()):\n", + " transformed_point = transform.TransformPoint(fixed_point_set.GetPoint(i))\n", + " transformed_point_set.SetPoint(i, transformed_point)\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "006a0386-1ad2-4d23-a0be-d565f56ae2f5", + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAhsAAAGiCAYAAABOCgSdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAY9ElEQVR4nO3df7CVdb3o8c8CcWPI3gmJsi8bQkpREFNRA8lKjStxOZqTpeMPjO4fFhjEWIo2gzTqNp3qdKNI1KEcx8HTqKh/QGIK5DQmoCThLxwZoQ7BGLE34HF53Pu5f3jd92zBIwv4rCV7v14za3Qtnmetz3dwZr1dz7PWUyqKoggAgCQ9aj0AANC1iQ0AIJXYAABSiQ0AIJXYAABSiQ0AIJXYAABSiQ0AIJXYAABSiQ0AIFVFsXHjjTdGqVTqdDv66KOzZgMAuoBDKt1hxIgR8fjjj3fc79mz5wEdCADoWiqOjUMOOcSnGQDAXqs4NtavXx+NjY1RV1cXZ5xxRtxyyy1xzDHHfOD25XI5yuVyx/329vbYtm1b9O/fP0ql0r5NDQBUVVEUsWPHjmhsbIwePSo75bNUySXmFy9eHG+++WYce+yxsWXLlrjpppvipZdeinXr1kX//v33uM+NN94Yc+bMqWgoAOCjadOmTTFo0KCK9qkoNt5v165dMWzYsPj+978fM2fO3OM27/9ko6WlJQYPHhybNm2K+vr6fX1pAKCKWltbo6mpKbZv3x4NDQ0V7VvxYZT/qk+fPnHiiSfG+vXrP3Cburq6qKur2+3x+vp6sQEAB5l9OQViv35no1wux4svvhgDBw7cn6cBALqwimLjmmuuieXLl8eGDRviT3/6U3z1q1+N1tbWmDx5ctZ8AMBBrqLDKH/961/jkksuiTfeeCOOPPLI+OxnPxtPP/10DBkyJGs+AOAgV1FsLFy4MGsOAKCLcm0UACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACCV2AAAUokNACDVfsVGc3NzlEqlmDFjxgEaBwDoavY5NlauXBnz58+PUaNGHch5AIAuZp9iY+fOnXHppZfGnXfeGUccccSBngkA6EL2KTamTp0aEydOjHPPPfdDty2Xy9Ha2trpBgB0H4dUusPChQvj2WefjZUrV+7V9s3NzTFnzpyKBwMAuoaKPtnYtGlTTJ8+Pe69997o3bv3Xu0za9asaGlp6bht2rRpnwYFAA5OpaIoir3deNGiRfGVr3wlevbs2fFYW1tblEql6NGjR5TL5U5/tietra3R0NAQLS0tUV9fv++TAwBVsz/v3xUdRjnnnHNi7dq1nR77xje+EcOHD49rr732Q0MDAOh+KoqNvn37xsiRIzs91qdPn+jfv/9ujwMARPgFUQAgWcXfRnm/ZcuWHYAxAICuyicbAEAqsQEApBIbAEAqsQEApBIbAEAqsQEApBIbAEAqsQEApBIbAEAqsQEApBIbAEAqsQEApBIb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JTYAgFRiAwBIJTYAgFRVjY3ueGn6FStWxKRJk6KxsTFKpVIsWrSo1iOla25ujtNOOy369u0bAwYMiAsuuCBefvnlWo+Vbt68eTFq1KiOXxUcM2ZMLF68uNZjVV1zc3OUSqWYMWNGrUdJdeONN0apVOp0O/roo2s9VlX87W9/i8suuyz69+8fH/vYx+Izn/lMrF69utZjpfrkJz+52993qVSKqVOn1nq0VO+880784Ac/iKFDh8Zhhx0WxxxzTPzwhz+M9vb2ip6narHRXS9Nv2vXrjjppJNi7ty5tR6lapYvXx5Tp06Np59+OpYuXRrvvPNOjB8/Pnbt2lXr0VINGjQobr311li1alWsWrUqzj777Dj//PNj3bp1tR6talauXBnz58+PUaNG1XqUqhgxYkRs3ry547Z27dpaj5Tun//8Z5x55pnRq1evWLx4cbzwwgvx4x//OD7+8Y/XerRUK1eu7PR3/d6PW1500UU1nizXj370o/jVr34Vc+fOjRdffDFuu+22uP322+PnP/95ZU9UVMnpp59eXHXVVZ0eGz58eHHddddVa4Sai4jioYceqvUYVbd169YiIorly5fXepSqO+KII4q77rqr1mNUxY4dO4pPf/rTxdKlS4vPf/7zxfTp02s9UqrZs2cXJ510Uq3HqLprr722GDduXK3HqLnp06cXw4YNK9rb22s9SqqJEycWU6ZM6fTYhRdeWFx22WUVPU9VPtl479L048eP7/T4f3dperqOlpaWiIh9ulLgwaqtrS0WLlwYu3btijFjxtR6nKqYOnVqTJw4Mc4999xaj1I169evj8bGxhg6dGhcfPHF8dprr9V6pHSPPPJIjB49Oi666KIYMGBAnHzyyXHnnXfWeqyqevvtt+Pee++NKVOmfOBFSLuKcePGxe9///t45ZVXIiLiz3/+czz11FPx5S9/uaLn2aervlZqXy5NT9dQFEXMnDkzxo0bFyNHjqz1OOnWrl0bY8aMibfeeisOP/zweOihh+KEE06o9VjpFi5cGM8++2ysXLmy1qNUzRlnnBH33HNPHHvssbFly5a46aabYuzYsbFu3bro379/rcdL89prr8W8efNi5syZcf3118czzzwT3/nOd6Kuri6uuOKKWo9XFYsWLYrt27fHlVdeWetR0l177bXR0tISw4cPj549e0ZbW1vcfPPNcckll1T0PFWJjfdUcml6uoZp06bF888/H0899VStR6mK4447LtasWRPbt2+PBx54ICZPnhzLly/v0sGxadOmmD59ejz22GPRu3fvWo9TNRMmTOj49xNPPDHGjBkTw4YNi9/85jcxc+bMGk6Wq729PUaPHh233HJLREScfPLJsW7dupg3b163iY277747JkyYEI2NjbUeJd39998f9957b9x3330xYsSIWLNmTcyYMSMaGxtj8uTJe/08VYkNl6bvnq6++up45JFHYsWKFTFo0KBaj1MVhx56aHzqU5+KiIjRo0fHypUr42c/+1nccccdNZ4sz+rVq2Pr1q1x6qmndjzW1tYWK1asiLlz50a5XI6ePXvWcMLq6NOnT5x44omxfv36Wo+SauDAgbvF8/HHHx8PPPBAjSaqrtdffz0ef/zxePDBB2s9SlV873vfi+uuuy4uvvjiiHg3rF9//fVobm6uKDaqcs6GS9N3L0VRxLRp0+LBBx+MJ554IoYOHVrrkWqmKIool8u1HiPVOeecE2vXro01a9Z03EaPHh2XXnpprFmzpluERkREuVyOF198MQYOHFjrUVKdeeaZu32V/ZVXXokhQ4bUaKLqWrBgQQwYMCAmTpxY61Gq4s0334wePTqnQs+ePSv+6mvVDqPs76XpD1Y7d+6MV199teP+hg0bYs2aNdGvX78YPHhwDSfLM3Xq1Ljvvvvi4Ycfjr59+3Z8otXQ0BCHHXZYjafLc/3118eECROiqakpduzYEQsXLoxly5bFkiVLaj1aqr59++52Pk6fPn2if//+Xfo8nWuuuSYmTZoUgwcPjq1bt8ZNN90Ura2tFf3f3sHou9/9bowdOzZuueWW+NrXvhbPPPNMzJ8/P+bPn1/r0dK1t7fHggULYvLkyXHIIVU9C6FmJk2aFDfffHMMHjw4RowYEc8991z85Cc/iSlTplT2RAfq6zF74xe/+EUxZMiQ4tBDDy1OOeWUbvFVyCeffLKIiN1ukydPrvVoafa03ogoFixYUOvRUk2ZMqXjv+8jjzyyOOecc4rHHnus1mPVRHf46uvXv/71YuDAgUWvXr2KxsbG4sILLyzWrVtX67Gq4tFHHy1GjhxZ1NXVFcOHDy/mz59f65Gq4ne/+10REcXLL79c61GqprW1tZg+fXoxePDgonfv3sUxxxxT3HDDDUW5XK7oeVxiHgBI5dooAEAqsQEApBIbAEAqsQEApBIbAEAqsQEApBIbAEAqsQEApBIbAEAqsQEApBIbAECq/wvuHrPT64DXIAAAAABJRU5ErkJggg==", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "plot_point_sets((transformed_point_set, moving_point_set))" + ] + } + ], + "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.11.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}