├── .gitignore ├── 0_Index.ipynb ├── 1_Introduction_to_the_Insight_Toolkit.ipynb ├── 2_Image_Filtering.ipynb ├── 3_Segmentation.ipynb ├── 4_ITK_in_Python.ipynb ├── 5_Registration.ipynb ├── 6_Extending_the_Toolkit-Part1.ipynb ├── 6_Extending_the_Toolkit-Part2.ipynb ├── Dockerfile.jupyterhub ├── Dockerfile.local ├── LICENSE ├── README.rst ├── binder └── Dockerfile ├── build.sh ├── check_env.ipynb ├── data ├── 005_32months_T2_RegT1_Reg2Atlas_ManualBrainMask_Stripped.nrrd ├── 6_Extend_0_Github-SplitComponents.png ├── 6_Extend_1_GitHub-SplitComponents-README.png ├── 6_Extend_2_Github-SplitComponents-Edit_and_create_branch.png ├── 6_Extend_3_Github-SplitComponents-CreatePR.png ├── 6_Extend_4.5_Github-TwoProjectionRegistration-PR-checks.png ├── 6_Extend_4_Github-SplitComponents-PR-created.png ├── 6_Extend_5_AzurePipeline-SplitComponents-Builds.png ├── 6_Extend_6_AzurePipeline-SplitComponents-Release.png ├── 6_Extend_7.5_AzurePipeline-TwoProjectionRegistration-ApproveDeploy.png ├── 6_Extend_7_AzurePipeline-SplitComponents-ReleasePipeline.png ├── 6_Extend_8_Pypi-split-components.png ├── BrainProtonDensitySlice.png ├── BrainProtonDensitySliceBorder20.png ├── BrainProtonDensitySliceShifted13x17y.png ├── CBCT-TextureInput.png ├── CBCT-TextureRunLengthNonUniformity.png ├── CondyleTextureMap.jpeg ├── DzZ_T1.nrrd ├── DzZ_T2.nrrd ├── Filtering.png ├── ForwardAndBackwardTransform.svg ├── KitwareITK.jpg ├── KitwareOverview.jpg ├── Mesh.png ├── PacMan.png ├── PhysicalSpace.png ├── Registration.png ├── Scan_CBCT_13R.nrrd ├── SegmC_CBCT_13R.nrrd ├── Segmentation1.png ├── Segmentation2.png ├── Segmentation3.png ├── Segmentation4.png ├── Segmentation5.png ├── SegmentationLevelSet.png ├── TransformDirection.png ├── Transformation.png ├── Ultrasound-B-mode.png ├── VisibleHumanHeadRender.png ├── VisibleHumanLogo.png ├── VisibleHumanSlice.png ├── WaveletReconstruction.png ├── WhiteMatter.png ├── biomechanics.jpg ├── brainweb165a10f17.mha ├── carotid-plaque.gif ├── confidence-connected.png ├── connected-threshold.png ├── data-pipeline.png ├── dzCBCT.nrrd ├── dzCBCT.png ├── dzCT211.nrrd ├── dzCT211c.nrrd ├── dzIntensities.png ├── dzIntensitiesCBCT-MRI.png ├── dzMR211.nrrd ├── dzTMJ.nrrd ├── dzTMJ.png ├── fast-marching-speed-image.png ├── fast-marching-time-crossing.png ├── github-logo.png ├── isolated-connected.png ├── itk-code-reviews.png ├── itk-contributors.png ├── itk-logo.png ├── jupyter-custom.css ├── kitware-logo-small.png ├── kitware-logo.png ├── level-set-concept.png ├── level-set-evolution.png ├── pipeline-updates.png ├── qdna1.mha ├── segmentation-categories.png ├── shape-detection-level-set.png ├── shape-detection-pipeline.png ├── sklearn │ ├── im0.nrrd │ ├── im0_label.nrrd │ ├── im1.nrrd │ ├── im1_label.nrrd │ ├── im2.nrrd │ ├── im2_label.nrrd │ ├── im3.nrrd │ ├── im3_label.nrrd │ ├── im4.nrrd │ ├── im4_label.nrrd │ ├── im5.nrrd │ ├── im5_label.nrrd │ ├── im6.nrrd │ ├── im6_label.nrrd │ ├── im7.nrrd │ ├── im7_label.nrrd │ ├── im8.nrrd │ ├── im8_label.nrrd │ ├── im9.nrrd │ └── im9_label.nrrd ├── streaming.gif ├── streaming.png └── transforms-and-pixels.png ├── run.sh └── solutions ├── 2_Image_Filtering_Exercise1.py ├── 2_Image_Filtering_Exercise2.py ├── 2_Image_Filtering_Exercise3.py ├── 2_Image_Filtering_Exercise4.py ├── 3_Segmentation_Exercise1.py ├── 3_Segmentation_Exercise2.py ├── 3_Segmentation_Exercise3.py ├── 4_ITK_and_NumPy_answers_Exercise1.py ├── 4_ITK_and_NumPy_answers_Exercise2.py ├── 4_Using_ITK_in_Python_real_world_filters_MeanFilter-TypeDeduction.py ├── 4_Using_ITK_in_Python_real_world_filters_MeanFilter.py ├── 4_Using_ITK_in_Python_real_world_filters_MedianFilter.py ├── 4_Using_ITK_in_Python_real_world_filters_OtsuFilter-TypeDeduction.py ├── 4_Using_ITK_in_Python_real_world_filters_OtsuFilter.py ├── 4_Using_ITK_in_Python_real_world_filters_mean.py ├── 4_Using_ITK_in_Python_real_world_filters_median.py ├── 4_Using_ITK_in_Python_real_world_filters_otsu.py ├── 5_Registration_Exercise2Answer1.py ├── 5_Registration_Exercise2Answer2.py ├── 5_Registration_Exercise4Answer.py ├── 6_Extending_the_toolkit_exercise.py ├── 6_Extending_the_toolkit_exercise1.py └── 6_Extending_the_toolkit_exercise2.py /.gitignore: -------------------------------------------------------------------------------- 1 | .ipynb_checkpoints/ 2 | notebook.tex 3 | -------------------------------------------------------------------------------- /0_Index.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "slideshow": { 7 | "slide_type": "slide" 8 | } 9 | }, 10 | "source": [ 11 | "# Biomedical Image Analysis and Visualization: ITK\n", 12 | "\n", 13 | "### Kitware, Carrboro, North Carolina\n", 14 | "### March, 2019\n", 15 | "\n", 16 | "Instructors:\n", 17 | "\n", 18 | "- Matt McCormick, PhD\n", 19 | "- Dženan Zukić, PhD\n", 20 | "- Francois Budin\n", 21 | "\n", 22 | "[![Kitware](data/kitware-logo.png)](https//www.kitware.com)" 23 | ] 24 | }, 25 | { 26 | "cell_type": "markdown", 27 | "metadata": { 28 | "slideshow": { 29 | "slide_type": "slide" 30 | } 31 | }, 32 | "source": [ 33 | "## Abstract\n", 34 | "\n", 35 | "[![ITK](data/itk-logo.png)](https://www.itk.org/)\n", 36 | "\n", 37 | "\n", 38 | "The [Insight Toolkit (ITK) (www.itk.org)](\n", 39 | "http://www.itk.org) has become a standard in academia and industry for\n", 40 | "medical image analysis. In recent years, the ITK community has\n", 41 | "focused on providing programming interfaces to ITK from Python and JavaScript\n", 42 | "and making ITK available via leading applications such as Slicer and ImageJ.\n", 43 | "In this course we present best practices for taking advantage of ITK in your\n", 44 | "imaging research and commercial products. We demonstrate how script writing\n", 45 | "and can be used to access the algorithms in ITK and the\n", 46 | "multitude of ITK extensions that are freely available on the web." 47 | ] 48 | }, 49 | { 50 | "cell_type": "markdown", 51 | "metadata": { 52 | "slideshow": { 53 | "slide_type": "slide" 54 | } 55 | }, 56 | "source": [ 57 | "## Tutorials\n", 58 | "\n", 59 | "1. [Introduction to the Insight Toolkit (ITK)](1_Introduction_to_the_Insight_Toolkit.ipynb)\n", 60 | "2. [Image Filtering](2_Image_Filtering.ipynb)\n", 61 | "3. [Segmentation](3_Segmentation.ipynb)\n", 62 | "4. [ITK in Python](4_ITK_in_Python.ipynb)\n", 63 | "5. [Registration](5_Registration.ipynb)\n", 64 | "6. [Extending the Toolkit (Part 1)](6_Extending_the_Toolkit-Part1.ipynb)\n", 65 | "7. [Extending the Toolkit (Part 2)](6_Extending_the_Toolkit-Part2.ipynb)\n", 66 | "8. [Introduction to itk.js](https://bit.ly/itkjsKitwareBiomedical2019)" 67 | ] 68 | } 69 | ], 70 | "metadata": { 71 | "celltoolbar": "Slideshow", 72 | "kernelspec": { 73 | "display_name": "Python 3", 74 | "language": "python", 75 | "name": "python3" 76 | }, 77 | "language_info": { 78 | "codemirror_mode": { 79 | "name": "ipython", 80 | "version": 3 81 | }, 82 | "file_extension": ".py", 83 | "mimetype": "text/x-python", 84 | "name": "python", 85 | "nbconvert_exporter": "python", 86 | "pygments_lexer": "ipython3", 87 | "version": "3.5.3" 88 | } 89 | }, 90 | "nbformat": 4, 91 | "nbformat_minor": 1 92 | } 93 | -------------------------------------------------------------------------------- /1_Introduction_to_the_Insight_Toolkit.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "slideshow": { 7 | "slide_type": "slide" 8 | } 9 | }, 10 | "source": [ 11 | "# Introduction to the Insight Toolkit (ITK)" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "metadata": { 17 | "slideshow": { 18 | "slide_type": "subslide" 19 | } 20 | }, 21 | "source": [ 22 | "### Learning Objectives\n", 23 | "\n", 24 | "* Learn how to **run** cells in **a Jupyter Notebook**\n", 25 | "* Run a segmentation example that demonstrates **ITK**'s ability to provide **insight into images**\n", 26 | "* Understand the **purpose and capabilities** of the toolkit" 27 | ] 28 | }, 29 | { 30 | "cell_type": "markdown", 31 | "metadata": { 32 | "slideshow": { 33 | "slide_type": "slide" 34 | } 35 | }, 36 | "source": [ 37 | "## Jupyter Notebooks" 38 | ] 39 | }, 40 | { 41 | "cell_type": "markdown", 42 | "metadata": { 43 | "slideshow": { 44 | "slide_type": "subslide" 45 | } 46 | }, 47 | "source": [ 48 | "These are [Jupyter Notebooks](https://jupyter.org/), an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text.\n", 49 | "\n", 50 | "To run cells in the notebook, press *shift + enter*.\n", 51 | "\n", 52 | "For more information, see the [Notebook Help](https://nbviewer.jupyter.org/github/ipython/ipython/blob/3.x/examples/Notebook/Index.ipynb)" 53 | ] 54 | }, 55 | { 56 | "cell_type": "markdown", 57 | "metadata": { 58 | "slideshow": { 59 | "slide_type": "slide" 60 | } 61 | }, 62 | "source": [ 63 | "## Insight Into Images" 64 | ] 65 | }, 66 | { 67 | "cell_type": "code", 68 | "execution_count": 1, 69 | "metadata": { 70 | "slideshow": { 71 | "slide_type": "slide" 72 | } 73 | }, 74 | "outputs": [], 75 | "source": [ 76 | "import itk\n", 77 | "\n", 78 | "from itkwidgets import view" 79 | ] 80 | }, 81 | { 82 | "cell_type": "code", 83 | "execution_count": 2, 84 | "metadata": { 85 | "slideshow": { 86 | "slide_type": "fragment" 87 | } 88 | }, 89 | "outputs": [ 90 | { 91 | "data": { 92 | "application/vnd.jupyter.widget-view+json": { 93 | "model_id": "4cdfc916fe954f998b62ecd4b18f637e", 94 | "version_major": 2, 95 | "version_minor": 0 96 | }, 97 | "text/plain": [ 98 | "Viewer(gradient_opacity=0.8, rendered_image= smoother" 287 | ] 288 | }, 289 | { 290 | "cell_type": "code", 291 | "execution_count": 5, 292 | "metadata": {}, 293 | "outputs": [ 294 | { 295 | "name": "stdout", 296 | "output_type": "stream", 297 | "text": [ 298 | "reader's Output: Image (0x55d4dead6c60)\n", 299 | " RTTI typeinfo: itk::Image\n", 300 | " Reference Count: 3\n", 301 | " Modified Time: 155\n", 302 | " Debug: Off\n", 303 | " Object Name: \n", 304 | " Observers: \n", 305 | " none\n", 306 | " Source: (0x55d4de5412b0) \n", 307 | " Source output name: Primary\n", 308 | " Release Data: Off\n", 309 | " Data Released: False\n", 310 | " Global Release Data: Off\n", 311 | " PipelineMTime: 0\n", 312 | " UpdateMTime: 0\n", 313 | " RealTimeStamp: 0 seconds \n", 314 | " LargestPossibleRegion: \n", 315 | " Dimension: 2\n", 316 | " Index: [0, 0]\n", 317 | " Size: [0, 0]\n", 318 | " BufferedRegion: \n", 319 | " Dimension: 2\n", 320 | " Index: [0, 0]\n", 321 | " Size: [0, 0]\n", 322 | " RequestedRegion: \n", 323 | " Dimension: 2\n", 324 | " Index: [0, 0]\n", 325 | " Size: [0, 0]\n", 326 | " Spacing: [1, 1]\n", 327 | " Origin: [0, 0]\n", 328 | " Direction: \n", 329 | "1 0\n", 330 | "0 1\n", 331 | "\n", 332 | " IndexToPointMatrix: \n", 333 | "1 0\n", 334 | "0 1\n", 335 | "\n", 336 | " PointToIndexMatrix: \n", 337 | "1 0\n", 338 | "0 1\n", 339 | "\n", 340 | " Inverse Direction: \n", 341 | "1 0\n", 342 | "0 1\n", 343 | "\n", 344 | " PixelContainer: \n", 345 | " ImportImageContainer (0x55d4e0d0c800)\n", 346 | " RTTI typeinfo: itk::ImportImageContainer\n", 347 | " Reference Count: 1\n", 348 | " Modified Time: 152\n", 349 | " Debug: Off\n", 350 | " Object Name: \n", 351 | " Observers: \n", 352 | " none\n", 353 | " Pointer: 0\n", 354 | " Container manages memory: true\n", 355 | " Size: 0\n", 356 | " Capacity: 0\n", 357 | "\n", 358 | "smoother's Output: Image (0x55d4e0e4f660)\n", 359 | " RTTI typeinfo: itk::Image\n", 360 | " Reference Count: 2\n", 361 | " Modified Time: 174\n", 362 | " Debug: Off\n", 363 | " Object Name: \n", 364 | " Observers: \n", 365 | " none\n", 366 | " Source: (0x55d4e0e91480) \n", 367 | " Source output name: Primary\n", 368 | " Release Data: Off\n", 369 | " Data Released: False\n", 370 | " Global Release Data: Off\n", 371 | " PipelineMTime: 0\n", 372 | " UpdateMTime: 0\n", 373 | " RealTimeStamp: 0 seconds \n", 374 | " LargestPossibleRegion: \n", 375 | " Dimension: 2\n", 376 | " Index: [0, 0]\n", 377 | " Size: [0, 0]\n", 378 | " BufferedRegion: \n", 379 | " Dimension: 2\n", 380 | " Index: [0, 0]\n", 381 | " Size: [0, 0]\n", 382 | " RequestedRegion: \n", 383 | " Dimension: 2\n", 384 | " Index: [0, 0]\n", 385 | " Size: [0, 0]\n", 386 | " Spacing: [1, 1]\n", 387 | " Origin: [0, 0]\n", 388 | " Direction: \n", 389 | "1 0\n", 390 | "0 1\n", 391 | "\n", 392 | " IndexToPointMatrix: \n", 393 | "1 0\n", 394 | "0 1\n", 395 | "\n", 396 | " PointToIndexMatrix: \n", 397 | "1 0\n", 398 | "0 1\n", 399 | "\n", 400 | " Inverse Direction: \n", 401 | "1 0\n", 402 | "0 1\n", 403 | "\n", 404 | " PixelContainer: \n", 405 | " ImportImageContainer (0x55d4e0609a70)\n", 406 | " RTTI typeinfo: itk::ImportImageContainer\n", 407 | " Reference Count: 1\n", 408 | " Modified Time: 171\n", 409 | " Debug: Off\n", 410 | " Object Name: \n", 411 | " Observers: \n", 412 | " none\n", 413 | " Pointer: 0\n", 414 | " Container manages memory: true\n", 415 | " Size: 0\n", 416 | " Capacity: 0\n", 417 | "\n" 418 | ] 419 | } 420 | ], 421 | "source": [ 422 | "print(\"reader's Output: %s\" % reader.GetOutput())\n", 423 | "print(\"smoother's Output: %s\" % smoother.GetOutput())" 424 | ] 425 | }, 426 | { 427 | "cell_type": "markdown", 428 | "metadata": { 429 | "slideshow": { 430 | "slide_type": "subslide" 431 | } 432 | }, 433 | "source": [ 434 | "To generate the filter outputs, we must call `Update()` on the filter at the end of the pipeline. In this case, it is the smoother." 435 | ] 436 | }, 437 | { 438 | "cell_type": "code", 439 | "execution_count": 6, 440 | "metadata": {}, 441 | "outputs": [ 442 | { 443 | "name": "stdout", 444 | "output_type": "stream", 445 | "text": [ 446 | "reader's Output: Image (0x55d4dead6c60)\n", 447 | " RTTI typeinfo: itk::Image\n", 448 | " Reference Count: 3\n", 449 | " Modified Time: 337\n", 450 | " Debug: Off\n", 451 | " Object Name: \n", 452 | " Observers: \n", 453 | " none\n", 454 | " Source: (0x55d4de5412b0) \n", 455 | " Source output name: Primary\n", 456 | " Release Data: Off\n", 457 | " Data Released: False\n", 458 | " Global Release Data: Off\n", 459 | " PipelineMTime: 165\n", 460 | " UpdateMTime: 338\n", 461 | " RealTimeStamp: 0 seconds \n", 462 | " LargestPossibleRegion: \n", 463 | " Dimension: 2\n", 464 | " Index: [0, 0]\n", 465 | " Size: [128, 128]\n", 466 | " BufferedRegion: \n", 467 | " Dimension: 2\n", 468 | " Index: [0, 0]\n", 469 | " Size: [128, 128]\n", 470 | " RequestedRegion: \n", 471 | " Dimension: 2\n", 472 | " Index: [0, 0]\n", 473 | " Size: [128, 128]\n", 474 | " Spacing: [1, 1]\n", 475 | " Origin: [0, 0]\n", 476 | " Direction: \n", 477 | "1 0\n", 478 | "0 1\n", 479 | "\n", 480 | " IndexToPointMatrix: \n", 481 | "1 0\n", 482 | "0 1\n", 483 | "\n", 484 | " PointToIndexMatrix: \n", 485 | "1 0\n", 486 | "0 1\n", 487 | "\n", 488 | " Inverse Direction: \n", 489 | "1 0\n", 490 | "0 1\n", 491 | "\n", 492 | " PixelContainer: \n", 493 | " ImportImageContainer (0x55d4e0d0c800)\n", 494 | " RTTI typeinfo: itk::ImportImageContainer\n", 495 | " Reference Count: 1\n", 496 | " Modified Time: 335\n", 497 | " Debug: Off\n", 498 | " Object Name: \n", 499 | " Observers: \n", 500 | " none\n", 501 | " Pointer: 0x55d4e14767b0\n", 502 | " Container manages memory: true\n", 503 | " Size: 16384\n", 504 | " Capacity: 16384\n", 505 | "\n", 506 | "smoother's Output: Image (0x55d4e0e4f660)\n", 507 | " RTTI typeinfo: itk::Image\n", 508 | " Reference Count: 2\n", 509 | " Modified Time: 342\n", 510 | " Debug: Off\n", 511 | " Object Name: \n", 512 | " Observers: \n", 513 | " none\n", 514 | " Source: (0x55d4e0e91480) \n", 515 | " Source output name: Primary\n", 516 | " Release Data: Off\n", 517 | " Data Released: False\n", 518 | " Global Release Data: Off\n", 519 | " PipelineMTime: 329\n", 520 | " UpdateMTime: 343\n", 521 | " RealTimeStamp: 0 seconds \n", 522 | " LargestPossibleRegion: \n", 523 | " Dimension: 2\n", 524 | " Index: [0, 0]\n", 525 | " Size: [128, 128]\n", 526 | " BufferedRegion: \n", 527 | " Dimension: 2\n", 528 | " Index: [0, 0]\n", 529 | " Size: [128, 128]\n", 530 | " RequestedRegion: \n", 531 | " Dimension: 2\n", 532 | " Index: [0, 0]\n", 533 | " Size: [128, 128]\n", 534 | " Spacing: [1, 1]\n", 535 | " Origin: [0, 0]\n", 536 | " Direction: \n", 537 | "1 0\n", 538 | "0 1\n", 539 | "\n", 540 | " IndexToPointMatrix: \n", 541 | "1 0\n", 542 | "0 1\n", 543 | "\n", 544 | " PointToIndexMatrix: \n", 545 | "1 0\n", 546 | "0 1\n", 547 | "\n", 548 | " Inverse Direction: \n", 549 | "1 0\n", 550 | "0 1\n", 551 | "\n", 552 | " PixelContainer: \n", 553 | " ImportImageContainer (0x55d4e0609a70)\n", 554 | " RTTI typeinfo: itk::ImportImageContainer\n", 555 | " Reference Count: 1\n", 556 | " Modified Time: 340\n", 557 | " Debug: Off\n", 558 | " Object Name: \n", 559 | " Observers: \n", 560 | " none\n", 561 | " Pointer: 0x55d4e0de7690\n", 562 | " Container manages memory: true\n", 563 | " Size: 16384\n", 564 | " Capacity: 16384\n", 565 | "\n" 566 | ] 567 | }, 568 | { 569 | "name": "stderr", 570 | "output_type": "stream", 571 | "text": [ 572 | "Running itkImageFileReaderIUC2... done\n", 573 | "Running itkRecursiveGaussianImageFilterIUC2IUC2... done\n", 574 | "done\n" 575 | ] 576 | } 577 | ], 578 | "source": [ 579 | "smoother.Update()\n", 580 | "\n", 581 | "print(\"reader's Output: %s\" % reader.GetOutput())\n", 582 | "print(\"smoother's Output: %s\" % smoother.GetOutput())" 583 | ] 584 | }, 585 | { 586 | "cell_type": "markdown", 587 | "metadata": { 588 | "slideshow": { 589 | "slide_type": "subslide" 590 | } 591 | }, 592 | "source": [ 593 | "Let's view the images." 594 | ] 595 | }, 596 | { 597 | "cell_type": "code", 598 | "execution_count": 7, 599 | "metadata": { 600 | "slideshow": { 601 | "slide_type": "subslide" 602 | } 603 | }, 604 | "outputs": [ 605 | { 606 | "name": "stderr", 607 | "output_type": "stream", 608 | "text": [ 609 | "Loading ITKBridgeNumPy... done\n" 610 | ] 611 | }, 612 | { 613 | "data": { 614 | "application/vnd.jupyter.widget-view+json": { 615 | "model_id": "1e119ec5d554462ab6ae1a9ed9d8c604", 616 | "version_major": 2, 617 | "version_minor": 0 618 | }, 619 | "text/plain": [ 620 | "Vmlld2VyKGdyYWRpZW50X29wYWNpdHk9MC4yMiwgcmVuZGVyZWRfaW1hZ2U9PGl0a0ltYWdlUHl0aG9uLml0a0ltYWdlVUMyOyBwcm94eSBvZiA8U3dpZyBPYmplY3Qgb2YgdHlwZSAnaXRrSW3igKY=\n" 621 | ] 622 | }, 623 | "metadata": {}, 624 | "output_type": "display_data" 625 | } 626 | ], 627 | "source": [ 628 | "image = reader.GetOutput()\n", 629 | "view(image)" 630 | ] 631 | }, 632 | { 633 | "cell_type": "code", 634 | "execution_count": 8, 635 | "metadata": { 636 | "slideshow": { 637 | "slide_type": "fragment" 638 | } 639 | }, 640 | "outputs": [ 641 | { 642 | "data": { 643 | "application/vnd.jupyter.widget-view+json": { 644 | "model_id": "d97431f90a42472db3eb700fa8a54d59", 645 | "version_major": 2, 646 | "version_minor": 0 647 | }, 648 | "text/plain": [ 649 | "Vmlld2VyKGdyYWRpZW50X29wYWNpdHk9MC4yMiwgcmVuZGVyZWRfaW1hZ2U9PGl0a0ltYWdlUHl0aG9uLml0a0ltYWdlVUMyOyBwcm94eSBvZiA8U3dpZyBPYmplY3Qgb2YgdHlwZSAnaXRrSW3igKY=\n" 650 | ] 651 | }, 652 | "metadata": {}, 653 | "output_type": "display_data" 654 | } 655 | ], 656 | "source": [ 657 | "smoothed = smoother.GetOutput()\n", 658 | "view(smoothed)" 659 | ] 660 | }, 661 | { 662 | "cell_type": "markdown", 663 | "metadata": { 664 | "slideshow": { 665 | "slide_type": "subslide" 666 | } 667 | }, 668 | "source": [ 669 | "If we call `Update()` on the pipeline, the output pixel data is not needlessly generated because the pipeline is up-to-date." 670 | ] 671 | }, 672 | { 673 | "cell_type": "code", 674 | "execution_count": 9, 675 | "metadata": {}, 676 | "outputs": [], 677 | "source": [ 678 | "smoother.Update()" 679 | ] 680 | }, 681 | { 682 | "cell_type": "markdown", 683 | "metadata": { 684 | "slideshow": { 685 | "slide_type": "subslide" 686 | } 687 | }, 688 | "source": [ 689 | "However, if we change the amount of smoothing, new pixel data does need to be generated from the output of the smoother." 690 | ] 691 | }, 692 | { 693 | "cell_type": "code", 694 | "execution_count": 10, 695 | "metadata": {}, 696 | "outputs": [ 697 | { 698 | "name": "stderr", 699 | "output_type": "stream", 700 | "text": [ 701 | "Running itkRecursiveGaussianImageFilterIUC2IUC2... done\n", 702 | "done\n" 703 | ] 704 | } 705 | ], 706 | "source": [ 707 | "smoother.SetSigma(10.0)\n", 708 | "smoother.Update()" 709 | ] 710 | }, 711 | { 712 | "cell_type": "code", 713 | "execution_count": 11, 714 | "metadata": {}, 715 | "outputs": [ 716 | { 717 | "data": { 718 | "application/vnd.jupyter.widget-view+json": { 719 | "model_id": "f63c68927f8248f496dd329846b541c8", 720 | "version_major": 2, 721 | "version_minor": 0 722 | }, 723 | "text/plain": [ 724 | "Vmlld2VyKGdyYWRpZW50X29wYWNpdHk9MC4yMiwgcmVuZGVyZWRfaW1hZ2U9PGl0a0ltYWdlUHl0aG9uLml0a0ltYWdlVUMyOyBwcm94eSBvZiA8U3dpZyBPYmplY3Qgb2YgdHlwZSAnaXRrSW3igKY=\n" 725 | ] 726 | }, 727 | "metadata": {}, 728 | "output_type": "display_data" 729 | } 730 | ], 731 | "source": [ 732 | "view(smoothed)" 733 | ] 734 | }, 735 | { 736 | "cell_type": "markdown", 737 | "metadata": { 738 | "slideshow": { 739 | "slide_type": "subslide" 740 | } 741 | }, 742 | "source": [ 743 | "Note, however, note that the reader does generate its output because it is up-to-date and upstream from the smoother.\n", 744 | "\n", 745 | "If we artificially modify the reader, both the reader and the smoother need to regenerate their outputs." 746 | ] 747 | }, 748 | { 749 | "cell_type": "code", 750 | "execution_count": 12, 751 | "metadata": {}, 752 | "outputs": [ 753 | { 754 | "name": "stderr", 755 | "output_type": "stream", 756 | "text": [ 757 | "Running itkImageFileReaderIUC2... done\n", 758 | "Running itkRecursiveGaussianImageFilterIUC2IUC2... done\n", 759 | "done\n" 760 | ] 761 | } 762 | ], 763 | "source": [ 764 | "reader.Modified()\n", 765 | "\n", 766 | "smoother.Update()" 767 | ] 768 | }, 769 | { 770 | "cell_type": "markdown", 771 | "metadata": { 772 | "slideshow": { 773 | "slide_type": "subslide" 774 | } 775 | }, 776 | "source": [ 777 | "We can stream the pipeline by placing a [StreamingImageFilter](https://itk.org/Doxygen/html/classitk_1_1StreamingImageFilter.html) at the **end** of the pipeline. The smoother generates outputs multiple times, once for each image region streaming division. Since the reader is not capable of streaming, it only generates its output once." 778 | ] 779 | }, 780 | { 781 | "cell_type": "code", 782 | "execution_count": 13, 783 | "metadata": {}, 784 | "outputs": [ 785 | { 786 | "name": "stderr", 787 | "output_type": "stream", 788 | "text": [ 789 | "Running itkStreamingImageFilterIUC2IUC2... Running itkImageFileReaderIUC2... done\n", 790 | "Running itkRecursiveGaussianImageFilterIUC2IUC2... done\n", 791 | "done\n", 792 | "Running itkStreamingImageFilterIUC2IUC2... Running itkRecursiveGaussianImageFilterIUC2IUC2... done\n", 793 | "done\n", 794 | "Running itkRecursiveGaussianImageFilterIUC2IUC2... done\n", 795 | "done\n", 796 | "done\n" 797 | ] 798 | } 799 | ], 800 | "source": [ 801 | "streamer = itk.StreamingImageFilter.New(Input=smoother.GetOutput())\n", 802 | "streamer.SetNumberOfStreamDivisions(3)\n", 803 | "reader.Modified()\n", 804 | "streamer.Update()" 805 | ] 806 | }, 807 | { 808 | "cell_type": "markdown", 809 | "metadata": { 810 | "slideshow": { 811 | "slide_type": "subslide" 812 | } 813 | }, 814 | "source": [ 815 | "A file writer can also stream data if the output format supports it." 816 | ] 817 | }, 818 | { 819 | "cell_type": "code", 820 | "execution_count": 14, 821 | "metadata": {}, 822 | "outputs": [ 823 | { 824 | "name": "stderr", 825 | "output_type": "stream", 826 | "text": [ 827 | "Running itkRecursiveGaussianImageFilterIUC2IUC2... done\n", 828 | "done\n", 829 | "Running itkImageFileWriterIUC2... Running itkRecursiveGaussianImageFilterIUC2IUC2... done\n", 830 | "done\n", 831 | "Running itkRecursiveGaussianImageFilterIUC2IUC2... done\n", 832 | "done\n", 833 | "Running itkRecursiveGaussianImageFilterIUC2IUC2... done\n", 834 | "done\n", 835 | "Running itkRecursiveGaussianImageFilterIUC2IUC2... done\n", 836 | "done\n", 837 | "done\n" 838 | ] 839 | } 840 | ], 841 | "source": [ 842 | "writer = itk.ImageFileWriter.New(Input=smoother.GetOutput())\n", 843 | "writer.SetFileName('my_output.mha')\n", 844 | "writer.SetNumberOfStreamDivisions(5)\n", 845 | "writer.Update()" 846 | ] 847 | }, 848 | { 849 | "cell_type": "markdown", 850 | "metadata": { 851 | "slideshow": { 852 | "slide_type": "slide" 853 | } 854 | }, 855 | "source": [ 856 | "## Exercises" 857 | ] 858 | }, 859 | { 860 | "cell_type": "markdown", 861 | "metadata": { 862 | "slideshow": { 863 | "slide_type": "subslide" 864 | } 865 | }, 866 | "source": [ 867 | "### Exercise 1: The effect of Sigma\n", 868 | "\n", 869 | "Change the value of Sigma on the smoothing filter.\n", 870 | "\n", 871 | "- How is the output effected?\n", 872 | "- What are the units of Sigma?" 873 | ] 874 | }, 875 | { 876 | "cell_type": "code", 877 | "execution_count": null, 878 | "metadata": {}, 879 | "outputs": [], 880 | "source": [ 881 | "# fileName = 'data/PacMan.png'\n", 882 | "# reader = itk.ImageFileReader.New(FileName=fileName)\n", 883 | "# smoother = itk.RecursiveGaussianImageFilter.New(Input=reader.GetOutput())\n", 884 | "# smoother.SetSigma(XX)\n", 885 | "# smoother.Update()\n", 886 | "# view(smoother.GetOutput())" 887 | ] 888 | }, 889 | { 890 | "cell_type": "code", 891 | "execution_count": 17, 892 | "metadata": { 893 | "slideshow": { 894 | "slide_type": "fragment" 895 | } 896 | }, 897 | "outputs": [], 898 | "source": [ 899 | "# %load solutions/2_Image_Filtering_Exercise1.py" 900 | ] 901 | }, 902 | { 903 | "cell_type": "markdown", 904 | "metadata": { 905 | "slideshow": { 906 | "slide_type": "subslide" 907 | } 908 | }, 909 | "source": [ 910 | "### Exercise 2: Does setting a filter parameter to its current value cause regeneration of its output?\n", 911 | "\n", 912 | "Call `smoother.SetSigma(smoother.GetSigma())` then `smoother.Update()`. \n", 913 | "\n", 914 | "- Is the output regenerated? \n", 915 | "- Is this expected / desirable?" 916 | ] 917 | }, 918 | { 919 | "cell_type": "code", 920 | "execution_count": null, 921 | "metadata": {}, 922 | "outputs": [], 923 | "source": [] 924 | }, 925 | { 926 | "cell_type": "code", 927 | "execution_count": 20, 928 | "metadata": { 929 | "slideshow": { 930 | "slide_type": "fragment" 931 | } 932 | }, 933 | "outputs": [], 934 | "source": [ 935 | "# %load solutions/2_Image_Filtering_Exercise2.py" 936 | ] 937 | }, 938 | { 939 | "cell_type": "markdown", 940 | "metadata": { 941 | "slideshow": { 942 | "slide_type": "subslide" 943 | } 944 | }, 945 | "source": [ 946 | "### Exercise 3: Find other image filtering algorithms\n", 947 | "\n", 948 | "The classes in ITK are organized into **Modules**, and collections of Modules are organized into **Groups**. Examine the [Image Smoothing](https://itk.org/Insight/Doxygen/html/group__ITKSmoothing.html) Module and the [Filtering](https://itk.org/Insight/Doxygen/html/group__Group-Filtering.html) Group. Can any other smoothing or denoising classes be found? " 949 | ] 950 | }, 951 | { 952 | "cell_type": "code", 953 | "execution_count": null, 954 | "metadata": {}, 955 | "outputs": [], 956 | "source": [] 957 | }, 958 | { 959 | "cell_type": "code", 960 | "execution_count": 23, 961 | "metadata": { 962 | "slideshow": { 963 | "slide_type": "fragment" 964 | } 965 | }, 966 | "outputs": [], 967 | "source": [ 968 | "# %load solutions/2_Image_Filtering_Exercise3.py" 969 | ] 970 | }, 971 | { 972 | "cell_type": "markdown", 973 | "metadata": { 974 | "slideshow": { 975 | "slide_type": "subslide" 976 | } 977 | }, 978 | "source": [ 979 | "### Exercise 4: Test different output format with streaming\n", 980 | "\n", 981 | "Not all file format support streaming. Test several of them and see which ones support it and which ones do not.\n", 982 | "Hint 1: To select a file format, select the corresponding file extension.\n", 983 | "Hint 2: Examples of file format: `jpg`, \n" 984 | ] 985 | }, 986 | { 987 | "cell_type": "code", 988 | "execution_count": null, 989 | "metadata": {}, 990 | "outputs": [], 991 | "source": [] 992 | }, 993 | { 994 | "cell_type": "code", 995 | "execution_count": 26, 996 | "metadata": { 997 | "slideshow": { 998 | "slide_type": "fragment" 999 | } 1000 | }, 1001 | "outputs": [], 1002 | "source": [ 1003 | "# %load solutions/2_Image_Filtering_Exercise4.py" 1004 | ] 1005 | }, 1006 | { 1007 | "cell_type": "markdown", 1008 | "metadata": {}, 1009 | "source": [ 1010 | "### Enjoy ITK!" 1011 | ] 1012 | } 1013 | ], 1014 | "metadata": { 1015 | "celltoolbar": "Slideshow", 1016 | "kernelspec": { 1017 | "display_name": "Python 2", 1018 | "language": "python", 1019 | "name": "python2" 1020 | }, 1021 | "language_info": { 1022 | "codemirror_mode": { 1023 | "name": "ipython", 1024 | "version": 2 1025 | }, 1026 | "file_extension": ".py", 1027 | "mimetype": "text/x-python", 1028 | "name": "python", 1029 | "nbconvert_exporter": "python", 1030 | "pygments_lexer": "ipython2", 1031 | "version": "2.7.15rc1" 1032 | } 1033 | }, 1034 | "nbformat": 4, 1035 | "nbformat_minor": 1 1036 | } 1037 | -------------------------------------------------------------------------------- /6_Extending_the_Toolkit-Part1.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "slideshow": { 7 | "slide_type": "slide" 8 | } 9 | }, 10 | "source": [ 11 | "# Extend ITK with your own module - Part 1" 12 | ] 13 | }, 14 | { 15 | "cell_type": "markdown", 16 | "metadata": { 17 | "slideshow": { 18 | "slide_type": "slide" 19 | } 20 | }, 21 | "source": [ 22 | "## Why?\n", 23 | "\n", 24 | "* New algorithm\n", 25 | "* Easy integration in ITK\n", 26 | "* Reproducible science\n", 27 | "* Easy Python wrapping" 28 | ] 29 | }, 30 | { 31 | "cell_type": "markdown", 32 | "metadata": { 33 | "collapsed": true, 34 | "slideshow": { 35 | "slide_type": "subslide" 36 | } 37 | }, 38 | "source": [ 39 | "## Requirements\n", 40 | "\n", 41 | "* [CMake](https://cmake.org/download/)\n", 42 | "* C++ development environment\n", 43 | " * Linux: `apt install build-essential cmake-curses-gui`\n", 44 | " * macOS: XCode (through App Store)\n", 45 | " * Windows: [Visual Studio](https://visualstudio.microsoft.com/vs/community/)\n", 46 | "* More details in the *Configuring and Building ITK* chapter of the [ITK Software Guide](https://itk.org/ItkSoftwareGuide.pdf)" 47 | ] 48 | }, 49 | { 50 | "cell_type": "markdown", 51 | "metadata": { 52 | "slideshow": { 53 | "slide_type": "slide" 54 | } 55 | }, 56 | "source": [ 57 | "## Why use C++\n", 58 | "\n", 59 | "* C++ allows the developer to have full access to ITK\n", 60 | " * Memory management\n", 61 | " * Thread management\n", 62 | "* Any dimension and pixel type supported.\n", 63 | "* Key element missing in Python: Iterators." 64 | ] 65 | }, 66 | { 67 | "cell_type": "markdown", 68 | "metadata": { 69 | "collapsed": true, 70 | "slideshow": { 71 | "slide_type": "subslide" 72 | } 73 | }, 74 | "source": [ 75 | "## Iterators\n", 76 | "\n", 77 | "* An iterator is a fast and safe way to access an entire range of memory.\n", 78 | "* It can be used to process an entire image." 79 | ] 80 | }, 81 | { 82 | "cell_type": "markdown", 83 | "metadata": { 84 | "collapsed": true, 85 | "slideshow": { 86 | "slide_type": "slide" 87 | } 88 | }, 89 | "source": [ 90 | "## ITK Modules\n", 91 | "\n", 92 | "* ITK is organized in modules\n", 93 | "* Each module typically contains filters that are related (e.g. Segmentation, Registration, Filtering)\n", 94 | "* [Modules in Doxygen](https://itk.org/Doxygen/html/modules.html)\n", 95 | "* [Module Python packages](https://pypi.org/search/?q=itk-)" 96 | ] 97 | }, 98 | { 99 | "cell_type": "markdown", 100 | "metadata": { 101 | "slideshow": { 102 | "slide_type": "slide" 103 | } 104 | }, 105 | "source": [ 106 | "## What are remote modules?\n", 107 | "\n", 108 | "* Remote modules are an easy way to develop new ITK filters and integrate them in ITK.\n", 109 | "* Allows the developer to easily publish and share their new algorithms.\n", 110 | "* ITK continuously contains the best available algorithms.\n", 111 | "* Remote modules are developed in separate repository from ITK. The developer(s) is (are) responsible of maintaining the project.\n", 112 | "* Remote modules integrate one or more filters implemented in C++ and their corresponding Python bindings." 113 | ] 114 | }, 115 | { 116 | "cell_type": "markdown", 117 | "metadata": { 118 | "collapsed": true, 119 | "slideshow": { 120 | "slide_type": "slide" 121 | } 122 | }, 123 | "source": [ 124 | "## Examples\n", 125 | "\n", 126 | "* ITKTextureFeatures\n", 127 | "* ITKUltrasound\n", 128 | "* ITKIsotropicWavelets" 129 | ] 130 | }, 131 | { 132 | "cell_type": "markdown", 133 | "metadata": { 134 | "slideshow": { 135 | "slide_type": "subslide" 136 | } 137 | }, 138 | "source": [ 139 | "## ITKTextureFeatures\n", 140 | "\n", 141 | "### Two filters:\n", 142 | "* itkCoocurrenceTextureFeaturesImageFilter: computes textural features based on intensity-based co-occurrence matrices in the image.\n", 143 | "* itkRunLengthTextureFeaturesImageFilter: computes textural features based on equally valued intensity clusters of different sizes or run lengths in the image.\n", 144 | "\n", 145 | "
\n", 146 | "
\n", 147 | "
\n", 148 | "
\n", 149 | " \n", 150 | "
Fig1. - CBCT of the test condyle
\n", 151 | "
\n", 152 | "
\n", 153 | "
\n", 154 | "
\n", 155 | " \n", 156 | "
Fig2. - texture’s run length non uniformity
\n", 157 | "
\n", 158 | "
\n", 159 | "
\n", 160 | "
\n", 161 | "\n", 162 | "- https://github.com/InsightSoftwareConsortium/ITKTextureFeatures\n", 163 | "- http://www.insight-journal.org/browse/publication/985\n", 164 | "\n", 165 | "```\n", 166 | "python -m pip install itk-texturefeatures\n", 167 | "```" 168 | ] 169 | }, 170 | { 171 | "cell_type": "markdown", 172 | "metadata": { 173 | "slideshow": { 174 | "slide_type": "subslide" 175 | } 176 | }, 177 | "source": [ 178 | "## ITKUltrasound\n", 179 | "\n", 180 | "* High performance ultrasound image formation and analysis based on the Insight Toolkit (ITK).\n", 181 | "* Introduction of an itk::StreamingResampleImageFilter.\n", 182 | "
\n", 183 | " \n", 184 | "
Fig1. Large, scan converted B-Mode image of anechoic spheres in a tissue mimicking ultrasound phantom. The image was processed without swapping to disk.
\n", 185 | "
\n", 186 | "\n", 187 | "- https://github.com/KitwareMedical/ITKUltrasound\n", 188 | "- http://www.insight-journal.org/browse/publication/722\n", 189 | "\n", 190 | "```\n", 191 | "python -m pip install itk-ultrasound\n", 192 | "```" 193 | ] 194 | }, 195 | { 196 | "cell_type": "markdown", 197 | "metadata": { 198 | "slideshow": { 199 | "slide_type": "subslide" 200 | } 201 | }, 202 | "source": [ 203 | "## ITKIsotropicWavelets\n", 204 | "\n", 205 | "* Multiresolution (MRA) analysis framework using isotropic and steerable wavelets in the frequency domain.\n", 206 | "* Provides the backbone for state of the art filters for denoising, feature detection or phase analysis in N-dimension\n", 207 | "\n", 208 | "- https://github.com/InsightSoftwareConsortium/ITKIsotropicWavelets\n", 209 | "- http://www.insight-journal.org/browse/publication/986\n", 210 | "\n", 211 | "```\n", 212 | "python -m pip install itk-isotropicwavelets\n", 213 | "```" 214 | ] 215 | }, 216 | { 217 | "cell_type": "code", 218 | "execution_count": 1, 219 | "metadata": { 220 | "slideshow": { 221 | "slide_type": "slide" 222 | } 223 | }, 224 | "outputs": [], 225 | "source": [ 226 | "import itk\n", 227 | "from itkwidgets import view" 228 | ] 229 | }, 230 | { 231 | "cell_type": "code", 232 | "execution_count": 2, 233 | "metadata": { 234 | "slideshow": { 235 | "slide_type": "subslide" 236 | } 237 | }, 238 | "outputs": [ 239 | { 240 | "name": "stdout", 241 | "output_type": "stream", 242 | "text": [ 243 | "Requirement already satisfied: itk-texturefeatures in /home/matt/bin/venvs/course/lib/python3.5/site-packages (3.2.0)\n", 244 | "Requirement already satisfied: itk>=5.0b01 in /home/matt/bin/venvs/course/lib/python3.5/site-packages (from itk-texturefeatures) (5.0rc1)\n", 245 | "Requirement already satisfied: itk-segmentation>=5.0rc1 in /home/matt/bin/venvs/course/lib/python3.5/site-packages (from itk>=5.0b01->itk-texturefeatures) (5.0rc1)\n", 246 | "Requirement already satisfied: itk-io>=5.0rc1 in /home/matt/bin/venvs/course/lib/python3.5/site-packages (from itk>=5.0b01->itk-texturefeatures) (5.0rc1)\n", 247 | "Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from itk>=5.0b01->itk-texturefeatures) (1.12.1)\n", 248 | "Requirement already satisfied: itk-filtering>=5.0rc1 in /home/matt/bin/venvs/course/lib/python3.5/site-packages (from itk>=5.0b01->itk-texturefeatures) (5.0rc1)\n", 249 | "Requirement already satisfied: itk-registration>=5.0rc1 in /home/matt/bin/venvs/course/lib/python3.5/site-packages (from itk>=5.0b01->itk-texturefeatures) (5.0rc1)\n", 250 | "Requirement already satisfied: itk-core>=5.0rc1 in /home/matt/bin/venvs/course/lib/python3.5/site-packages (from itk>=5.0b01->itk-texturefeatures) (5.0rc1)\n", 251 | "Requirement already satisfied: itk-numerics>=5.0rc1 in /home/matt/bin/venvs/course/lib/python3.5/site-packages (from itk>=5.0b01->itk-texturefeatures) (5.0rc1)\n" 252 | ] 253 | } 254 | ], 255 | "source": [ 256 | "# Install itk-texturefeatures if not already installed\n", 257 | "import sys\n", 258 | "!{sys.executable} -m pip install itk-texturefeatures" 259 | ] 260 | }, 261 | { 262 | "cell_type": "markdown", 263 | "metadata": { 264 | "slideshow": { 265 | "slide_type": "slide" 266 | } 267 | }, 268 | "source": [ 269 | "## Exercise: Reproduce a bone texture map\n", 270 | "\n", 271 | "Reproduce the condyle texture map from the [*Computing Textural Feature Maps for N-Dimensional Images*](http://insight-journal.org/browse/publication/985) article.\n", 272 | "\n", 273 | "" 274 | ] 275 | }, 276 | { 277 | "cell_type": "code", 278 | "execution_count": 6, 279 | "metadata": { 280 | "slideshow": { 281 | "slide_type": "subslide" 282 | } 283 | }, 284 | "outputs": [ 285 | { 286 | "data": { 287 | "application/vnd.jupyter.widget-view+json": { 288 | "model_id": "d592f2e33e7e401db3226bc403f78772", 289 | "version_major": 2, 290 | "version_minor": 0 291 | }, 292 | "text/plain": [ 293 | "Viewer(gradient_opacity=0.22, mode='z', rendered_image=\n", 91 | " (itk) fbudin:ITKModuleTemplate/ $ tree -a\n", 92 | " .\n", 93 | " ├── appveyor.yml\n", 94 | " ├── .circleci\n", 95 | " │   └── config.yml\n", 96 | " ├── CMakeLists.txt\n", 97 | " ├── CTestConfig.cmake\n", 98 | " ├── include\n", 99 | " │   ├── itkMinimalStandardRandomVariateGenerator.h\n", 100 | " │   ├── itkMyFilter.h\n", 101 | " │   ├── itkMyFilter.hxx\n", 102 | " │   ├── itkNormalDistributionImageSource.h\n", 103 | " │   └── itkNormalDistributionImageSource.hxx\n", 104 | " ├── itk-module.cmake\n", 105 | " ├── LICENSE\n", 106 | " ├── README.rst\n", 107 | " ├── setup.py\n", 108 | "" 109 | ] 110 | }, 111 | { 112 | "cell_type": "markdown", 113 | "metadata": { 114 | "slideshow": { 115 | "slide_type": "subslide" 116 | } 117 | }, 118 | "source": [ 119 | "
\n",
120 |     "        ├── src\n",
121 |     "        │   ├── CMakeLists.txt\n",
122 |     "        │   └── itkMinimalStandardRandomVariateGenerator.cxx\n",
123 |     "        ├── test\n",
124 |     "        │   ├── Baseline\n",
125 |     "        │   │   ├── itkMyFilterTestOutput.mha.sha512\n",
126 |     "        │   │   └── itkNormalDistributionImageSourceTestOutput.mha.sha512\n",
127 |     "        │   ├── CMakeLists.txt\n",
128 |     "        │   ├── itkMinimalStandardRandomVariateGeneratorTest.cxx\n",
129 |     "        │   ├── itkMyFilterTest.cxx\n",
130 |     "        │   └── itkNormalDistributionImageSourceTest.cxx\n",
131 |     "        ├── .travis.yml\n",
132 |     "        └── wrapping\n",
133 |     "            ├── CMakeLists.txt\n",
134 |     "            ├── itkMinimalStandardRandomVariateGenerator.wrap\n",
135 |     "            └── itkNormalDistributionImageSource.wrap\n",
136 |     "
" 137 | ] 138 | }, 139 | { 140 | "cell_type": "markdown", 141 | "metadata": { 142 | "collapsed": true, 143 | "slideshow": { 144 | "slide_type": "slide" 145 | } 146 | }, 147 | "source": [ 148 | "## Directory structure\n", 149 | "\n", 150 | "* `src` and `include`: header files and source code\n", 151 | "* `test`: unit tests\n", 152 | "* `wrapping`: Required files to automatically create Python bindings." 153 | ] 154 | }, 155 | { 156 | "cell_type": "markdown", 157 | "metadata": { 158 | "slideshow": { 159 | "slide_type": "slide" 160 | } 161 | }, 162 | "source": [ 163 | "## Filter code\n", 164 | "\n", 165 | "
\n",
166 |     "template< typename TInputImage, typename TOutputImage >\n",
167 |     "void\n",
168 |     "MyFilter< TInputImage, TOutputImage >\n",
169 |     "::DynamicThreadedGenerateData( const OutputRegionType & outputRegion)\n",
170 |     "{\n",
171 |     "  OutputImageType * output = this->GetOutput();\n",
172 |     "  const InputImageType * input = this->GetInput();\n",
173 |     "  using InputRegionType = typename InputImageType::RegionType;\n",
174 |     "  InputRegionType inputRegion = InputRegionType(outputRegion.GetSize());\n",
175 |     "\n",
176 |     "  itk::ImageRegionConstIterator in(input, inputRegion);\n",
177 |     "  itk::ImageRegionIterator out(output, outputRegion);\n",
178 |     "\n",
179 |     "  for (in.GoToBegin(), out.GoToBegin(); !in.IsAtEnd() && !out.IsAtEnd(); ++in, ++out)\n",
180 |     "  {\n",
181 |     "    out.Set( in.Get() );\n",
182 |     "  }\n",
183 |     "}\n",
184 |     "
" 185 | ] 186 | }, 187 | { 188 | "cell_type": "markdown", 189 | "metadata": { 190 | "collapsed": true, 191 | "slideshow": { 192 | "slide_type": "slide" 193 | } 194 | }, 195 | "source": [ 196 | "## Continuous integration\n", 197 | "\n", 198 | "* Appveyor (Windows)\n", 199 | "* Travis (MacOS)\n", 200 | "* CircleCI (Linux)\n", 201 | "* Azure pipeline (Windows, Linux, MacOS)" 202 | ] 203 | }, 204 | { 205 | "cell_type": "markdown", 206 | "metadata": { 207 | "slideshow": { 208 | "slide_type": "slide" 209 | } 210 | }, 211 | "source": [ 212 | "## Python packages\n", 213 | "\n", 214 | "* Automatically generated with Azure Pipeline\n", 215 | "* Python Wheels automatically uploaded to [PyPI.org](https://pypi.org/search/?q=itk)" 216 | ] 217 | }, 218 | { 219 | "cell_type": "markdown", 220 | "metadata": { 221 | "collapsed": true, 222 | "slideshow": { 223 | "slide_type": "slide" 224 | } 225 | }, 226 | "source": [ 227 | "## Where to find more information:\n", 228 | "\n", 229 | "* ITK Software Guide\n", 230 | " * [Configuring and building ITK](https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch2.html#x22-130002)\n", 231 | " * [Create a remote module](https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch9.html#x55-1640009.7)\n", 232 | " * [How to write a filter](https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch8.html#x54-1330008)\n", 233 | " * [Iterators](https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch6.html#x44-1020006)\n", 234 | " * [Modules](https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch9.html#x48-1480009)\n", 235 | "* [Discourse forum](https://discourse.itk.org/)" 236 | ] 237 | }, 238 | { 239 | "cell_type": "markdown", 240 | "metadata": { 241 | "slideshow": { 242 | "slide_type": "slide" 243 | } 244 | }, 245 | "source": [ 246 | "## Exercises" 247 | ] 248 | }, 249 | { 250 | "cell_type": "markdown", 251 | "metadata": { 252 | "slideshow": { 253 | "slide_type": "subslide" 254 | } 255 | }, 256 | "source": [ 257 | "### Exercise 1: Create the skeleton of a remote module\n", 258 | "\n", 259 | "* Hint1: Open a Notebook terminal (File->Open, New->Terminal)\n", 260 | "* Hint2: You will need to add the argument '--no-input' to the command you are using. This is a limitation due to this notebook environment." 261 | ] 262 | }, 263 | { 264 | "cell_type": "code", 265 | "execution_count": 9, 266 | "metadata": { 267 | "slideshow": { 268 | "slide_type": "-" 269 | } 270 | }, 271 | "outputs": [], 272 | "source": [ 273 | "# %load solutions/6_Extending_the_toolkit_exercise1.py" 274 | ] 275 | }, 276 | { 277 | "cell_type": "markdown", 278 | "metadata": { 279 | "slideshow": { 280 | "slide_type": "subslide" 281 | } 282 | }, 283 | "source": [ 284 | "### Exercise 2: Modify the filter\n", 285 | "\n", 286 | "* Add a constant value\n", 287 | "* Multiply by a constant factor\n" 288 | ] 289 | }, 290 | { 291 | "cell_type": "code", 292 | "execution_count": 10, 293 | "metadata": { 294 | "slideshow": { 295 | "slide_type": "-" 296 | } 297 | }, 298 | "outputs": [], 299 | "source": [ 300 | "# %load solutions/6_Extending_the_toolkit_exercise2.py" 301 | ] 302 | }, 303 | { 304 | "cell_type": "markdown", 305 | "metadata": { 306 | "slideshow": { 307 | "slide_type": "slide" 308 | } 309 | }, 310 | "source": [ 311 | "## Github and Continuous Integration (CI)" 312 | ] 313 | }, 314 | { 315 | "cell_type": "markdown", 316 | "metadata": { 317 | "slideshow": { 318 | "slide_type": "subslide" 319 | } 320 | }, 321 | "source": [ 322 | "Taking a look at an existing remote module: [ITKSplitComponents](https://github.com/InsightSoftwareConsortium/ITKSplitComponents)" 323 | ] 324 | }, 325 | { 326 | "cell_type": "markdown", 327 | "metadata": { 328 | "slideshow": { 329 | "slide_type": "subslide" 330 | } 331 | }, 332 | "source": [ 333 | "* It is very similar to the module we created on our computer.\n", 334 | "* You can modify it directly in your browser." 335 | ] 336 | }, 337 | { 338 | "cell_type": "markdown", 339 | "metadata": { 340 | "slideshow": { 341 | "slide_type": "subslide" 342 | } 343 | }, 344 | "source": [ 345 | "[![Kitware](data/6_Extend_0_Github-SplitComponents.png)](https://github.com/InsightSoftwareConsortium/ITKSplitComponents)" 346 | ] 347 | }, 348 | { 349 | "cell_type": "markdown", 350 | "metadata": { 351 | "slideshow": { 352 | "slide_type": "subslide" 353 | } 354 | }, 355 | "source": [ 356 | "[![Kitware](data/6_Extend_1_GitHub-SplitComponents-README.png)](https://github.com/InsightSoftwareConsortium/ITKSplitComponents/blob/master/README.rst)" 357 | ] 358 | }, 359 | { 360 | "cell_type": "markdown", 361 | "metadata": { 362 | "slideshow": { 363 | "slide_type": "subslide" 364 | } 365 | }, 366 | "source": [ 367 | "[![Kitware](data/6_Extend_2_Github-SplitComponents-Edit_and_create_branch.png)](https://github.com/InsightSoftwareConsortium/ITKSplitComponents/edit/master/README.rst)" 368 | ] 369 | }, 370 | { 371 | "cell_type": "markdown", 372 | "metadata": { 373 | "slideshow": { 374 | "slide_type": "subslide" 375 | } 376 | }, 377 | "source": [ 378 | "[![Kitware](data/6_Extend_3_Github-SplitComponents-CreatePR.png)](https://github.com/InsightSoftwareConsortium/ITKSplitComponents)" 379 | ] 380 | }, 381 | { 382 | "cell_type": "markdown", 383 | "metadata": { 384 | "slideshow": { 385 | "slide_type": "subslide" 386 | } 387 | }, 388 | "source": [ 389 | "![Kitware](data/6_Extend_4_Github-SplitComponents-PR-created.png)" 390 | ] 391 | }, 392 | { 393 | "cell_type": "markdown", 394 | "metadata": { 395 | "slideshow": { 396 | "slide_type": "subslide" 397 | } 398 | }, 399 | "source": [ 400 | "[![Kitware](data/6_Extend_4.5_Github-TwoProjectionRegistration-PR-checks.png)](https://github.com/InsightSoftwareConsortium/ITKTwoProjectionRegistration/pull/11/checks?check_run_id=77068613)" 401 | ] 402 | }, 403 | { 404 | "cell_type": "markdown", 405 | "metadata": { 406 | "slideshow": { 407 | "slide_type": "subslide" 408 | } 409 | }, 410 | "source": [ 411 | "[![Kitware](data/6_Extend_5_AzurePipeline-SplitComponents-Builds.png)](https://dev.azure.com/InsightSoftwareConsortium/ITKModules/_build/results?buildId=217)" 412 | ] 413 | }, 414 | { 415 | "cell_type": "markdown", 416 | "metadata": { 417 | "slideshow": { 418 | "slide_type": "subslide" 419 | } 420 | }, 421 | "source": [ 422 | "[![Kitware](data/6_Extend_6_AzurePipeline-SplitComponents-Release.png)](https://dev.azure.com/InsightSoftwareConsortium/ITKModules/_release?view=mine&definitionId=6)" 423 | ] 424 | }, 425 | { 426 | "cell_type": "markdown", 427 | "metadata": { 428 | "slideshow": { 429 | "slide_type": "subslide" 430 | } 431 | }, 432 | "source": [ 433 | "[![Kitware](data/6_Extend_7.5_AzurePipeline-TwoProjectionRegistration-ApproveDeploy.png)](https://dev.azure.com/InsightSoftwareConsortium/ITKModules/_releaseProgress?_a=release-pipeline-progress&releaseId=39)" 434 | ] 435 | }, 436 | { 437 | "cell_type": "markdown", 438 | "metadata": { 439 | "slideshow": { 440 | "slide_type": "subslide" 441 | } 442 | }, 443 | "source": [ 444 | "[![Kitware](data/6_Extend_7_AzurePipeline-SplitComponents-ReleasePipeline.png)](https://dev.azure.com/InsightSoftwareConsortium/ITKModules/_releaseProgress?_a=release-pipeline-progress&releaseId=33)" 445 | ] 446 | }, 447 | { 448 | "cell_type": "markdown", 449 | "metadata": { 450 | "slideshow": { 451 | "slide_type": "subslide" 452 | } 453 | }, 454 | "source": [ 455 | "[![Kitware](data/6_Extend_8_Pypi-split-components.png)](https://pypi.org/project/itk-splitcomponents/#files)" 456 | ] 457 | }, 458 | { 459 | "cell_type": "markdown", 460 | "metadata": { 461 | "slideshow": { 462 | "slide_type": "slide" 463 | } 464 | }, 465 | "source": [ 466 | "### Enjoy ITK!" 467 | ] 468 | } 469 | ], 470 | "metadata": { 471 | "celltoolbar": "Slideshow", 472 | "kernelspec": { 473 | "display_name": "Python 3", 474 | "language": "python", 475 | "name": "python3" 476 | }, 477 | "language_info": { 478 | "codemirror_mode": { 479 | "name": "ipython", 480 | "version": 3 481 | }, 482 | "file_extension": ".py", 483 | "mimetype": "text/x-python", 484 | "name": "python", 485 | "nbconvert_exporter": "python", 486 | "pygments_lexer": "ipython3", 487 | "version": "3.5.3" 488 | } 489 | }, 490 | "nbformat": 4, 491 | "nbformat_minor": 2 492 | } 493 | -------------------------------------------------------------------------------- /Dockerfile.jupyterhub: -------------------------------------------------------------------------------- 1 | FROM thewtex/krs-course:local 2 | 3 | RUN python -m pip install git+https://github.com/data-8/nbgitpuller && \ 4 | python -m jupyter serverextension enable --py nbgitpuller --sys-prefix 5 | 6 | ADD LICENSE /home/jovyan/ 7 | ADD *.ipynb /home/jovyan/ 8 | ADD solutions /home/jovyan/solutions 9 | ADD data /home/jovyan/data 10 | ENV NB_UID 1000 11 | USER root 12 | RUN chown -R ${NB_UID}:users ${HOME} 13 | USER $NB_USER 14 | RUN rmdir /home/jovyan/work 15 | 16 | CMD ["/usr/local/bin/start-singleuser.sh"] 17 | -------------------------------------------------------------------------------- /Dockerfile.local: -------------------------------------------------------------------------------- 1 | FROM jupyter/scipy-notebook:6fb3eca57bd3 2 | MAINTAINER Matt McCormick 3 | 4 | RUN conda install --yes --quiet -c damianavila82 rise 5 | RUN python -m pip install --upgrade --pre itk itk-texturefeatures 6 | RUN python -m pip install itkwidgets 7 | RUN mkdir -p $HOME/.jupyter && \ 8 | echo "c.NotebookApp.iopub_data_rate_limit=1e22" >> $HOME/.jupyter/jupyter_notebook_config.py 9 | RUN python -m pip install cookiecutter 10 | 11 | ADD data/kitware-logo-small.png /home/jovyan/.jupyter/custom/logo.png 12 | ADD data/jupyter-custom.css /home/jovyan/.jupyter/custom/custom.css 13 | USER root 14 | RUN chown -R $NB_USER:users /home/jovyan/.jupyter 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | **NOTE:** The updated version of this course material is here: https://github.com/InsightSoftwareConsortium/ScientificImageAnalysisVisualizationAndArtificialIntelligenceCourse 2 | 3 | Biomedical Image Analysis and Visualization: ITK 4 | ================================================ 5 | Kitware, Carrboro, North Carolina, USA 6 | ====================================== 7 | 8 | .. image:: https://mybinder.org/badge.svg 9 | :target: https://mybinder.org/v2/gh/KitwareMedical/2019-03-13-KRSCourseInBiomedicalImageAnalysisAndVisualization/master 10 | 11 | Instructors: 12 | 13 | - Matt McCormick, PhD 14 | - Dženan Zukić, PhD 15 | - Francois Budin 16 | 17 | .. image:: data/kitware-logo.png 18 | :alt: Kitware 19 | :width: 400px 20 | 21 | .. image:: data/itk-logo.png 22 | :alt: ITK 23 | :width: 500px 24 | 25 | 26 | The `Insight Toolkit (ITK) (www.itk.org) `_ 27 | has become a standard in academia and industry for 28 | medical image analysis. In recent years, the ITK community has 29 | focused on providing programming interfaces to ITK from Python and JavaScript 30 | and making ITK available via leading applications such as Slicer and ImageJ. 31 | In this course we present best practices for taking advantage of ITK in your 32 | imaging research and commercial products. We demonstrate how script writing 33 | and can be used to access the algorithms in ITK and the 34 | multitude of ITK extensions that are freely available on the web. 35 | 36 | Run the Tutorial 37 | ---------------- 38 | 39 | There are many ways to run these tutorials. 40 | 41 | On the Web, with Binder 42 | ^^^^^^^^^^^^^^^^^^^^^^^ 43 | 44 | To run the notebooks in 45 | `MyBinder `_, 46 | simply `click this link `_. 47 | 48 | Locally, with Python from Python.org or a System Python 49 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 50 | 51 | First, `install Python 52 | `_, 53 | if not already available. 54 | 55 | Next, install the required dependencies:: 56 | 57 | python -m pip install tornado==5.1.1 jupyter matplotlib numpy scipy ipywidgets scikit-learn cookiecutter 58 | python -m pip install --upgrade --pre itk itk-texturefeatures 59 | python -m pip install itkwidgets 60 | 61 | Then, clone the repository:: 62 | 63 | git clone https://github.com/KitwareMedical/2019-03-13-KRSCourseInBiomedicalImageAnalysisAndVisualization.git 64 | cd 2019-03-13-KRSCourseInBiomedicalImageAnalysisAndVisualization 65 | 66 | And start Jupyter:: 67 | 68 | python -m jupyter notebook 69 | 70 | Locally, with Conda 71 | ^^^^^^^^^^^^^^^^^^^ 72 | 73 | First, `install MiniConda `_ or Anaconda, if 74 | not already available. 75 | 76 | Next, install the required dependencies:: 77 | 78 | conda install -c conda-forge jupyter matplotlib numpy scipy ipywidgets scikit-learn cookiecutter 79 | python -m pip install --upgrade --pre itk itk-texturefeatures 80 | python -m pip install itkwidgets 81 | 82 | Then, clone the repository:: 83 | 84 | git clone https://github.com/KitwareMedical/2019-03-13-KRSCourseInBiomedicalImageAnalysisAndVisualization.git 85 | cd 2019-03-13-KRSCourseInBiomedicalImageAnalysisAndVisualization 86 | 87 | And start Jupyter:: 88 | 89 | python -m jupyter notebook 90 | 91 | Locally, with Docker 92 | ^^^^^^^^^^^^^^^^^^^^ 93 | 94 | First, `install Docker `_, if not already 95 | available. 96 | 97 | Next, clone the repository:: 98 | 99 | git clone https://github.com/KitwareMedical/2019-03-13-KRSCourseInBiomedicalImageAnalysisAndVisualization.git 100 | cd 2019-03-13-KRSCourseInBiomedicalImageAnalysisAndVisualization 101 | 102 | Then, build and run the Docker image:: 103 | 104 | ./build.sh 105 | ./run.sh 106 | 107 | Paste the URL presented in the terminal in your web browser. 108 | 109 | With Jupyter Lab instead of the Jupyter Notebook 110 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 111 | 112 | To run under [Jupyter Lab](https://jupyterlab.readthedocs.io/en/stable/) 113 | instead of the Jupyter Notebook, install the *jupyterlab* package and 114 | [Node.js](https://nodejs.org/en/download/), e.g.:: 115 | 116 | conda install jupyterlab nodejs 117 | 118 | Then install the required extensions:: 119 | 120 | jupyter labextension install @jupyter-widgets/jupyterlab-manager itk-jupyter-widgets 121 | 122 | And start Jupyter with:: 123 | 124 | python -m jupyter lab 125 | 126 | instead of:: 127 | 128 | python -m jupyter notebook 129 | -------------------------------------------------------------------------------- /binder/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM thewtex/krs-course:3780abd 2 | 3 | 4 | CMD ["start-notebook.sh"] 5 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 6 | 7 | docker build -f Dockerfile.local -t thewtex/krs-course:local $DIR 8 | docker build -f Dockerfile.jupyterhub -t thewtex/krs-course:$(git rev-parse HEAD | cut -c1-7) $DIR 9 | -------------------------------------------------------------------------------- /check_env.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "from __future__ import print_function\n", 10 | "from distutils.version import LooseVersion as Version\n", 11 | "import sys\n", 12 | "\n", 13 | "\n", 14 | "try:\n", 15 | " import curses\n", 16 | " curses.setupterm()\n", 17 | " assert curses.tigetnum(\"colors\") > 2\n", 18 | " OK = \"\\x1b[1;%dm[ OK ]\\x1b[0m\" % (30 + curses.COLOR_GREEN)\n", 19 | " FAIL = \"\\x1b[1;%dm[FAIL]\\x1b[0m\" % (30 + curses.COLOR_RED)\n", 20 | "except:\n", 21 | " OK = '[ OK ]'\n", 22 | " FAIL = '[FAIL]'\n", 23 | "\n", 24 | "try:\n", 25 | " import importlib\n", 26 | "except ImportError:\n", 27 | " print(FAIL, \"Python version 3.5 (or 2.7) is required,\"\n", 28 | " \" but %s is installed.\" % sys.version)\n", 29 | "\n", 30 | " \n", 31 | "def import_version(pkg, min_ver, fail_msg=\"\"):\n", 32 | " mod = None\n", 33 | " try:\n", 34 | " mod = importlib.import_module(pkg)\n", 35 | " if pkg in {'itk'}:\n", 36 | " ver = mod.Version.GetITKVersion()\n", 37 | " else:\n", 38 | " ver = mod.__version__\n", 39 | " if Version(ver) < min_ver:\n", 40 | " print(FAIL, \"%s version %s or higher required, but %s installed.\"\n", 41 | " % (lib, min_ver, ver))\n", 42 | " else:\n", 43 | " print(OK, '%s version %s' % (pkg, ver))\n", 44 | " except ImportError:\n", 45 | " print(FAIL, '%s not installed. %s' % (pkg, fail_msg))\n", 46 | " return mod\n", 47 | "\n", 48 | "\n", 49 | "# first check the python version\n", 50 | "print('Using python in', sys.prefix)\n", 51 | "print(sys.version)\n", 52 | "pyversion = Version(sys.version)\n", 53 | "if pyversion >= \"3\":\n", 54 | " if pyversion < \"3.5\":\n", 55 | " print(FAIL, \"Python version 3.5 (or 2.7) is required,\"\n", 56 | " \" but %s is installed.\" % sys.version)\n", 57 | "elif pyversion >= \"2\":\n", 58 | " if pyversion < \"2.7\":\n", 59 | " print(FAIL, \"Python version 2.7 is required,\"\n", 60 | " \" but %s is installed.\" % sys.version)\n", 61 | "else:\n", 62 | " print(FAIL, \"Unknown Python version: %s\" % sys.version)\n", 63 | "\n", 64 | "print()\n", 65 | "requirements = {'numpy': \"1.6.1\", 'scipy': \"0.9\", 'matplotlib': \"2.0\",\n", 66 | " 'IPython': \"3.0\", 'sklearn': \"0.20\", 'itk': \"5.0\",\n", 67 | " 'itkwidgets': \"0.16\", 'ipywidgets': '7.4', 'notebook': '5.4'}\n", 68 | "\n", 69 | "# now the dependencies\n", 70 | "for lib, required_version in list(requirements.items()):\n", 71 | " import_version(lib, required_version)" 72 | ] 73 | } 74 | ], 75 | "metadata": { 76 | "anaconda-cloud": {}, 77 | "kernelspec": { 78 | "display_name": "Python 3", 79 | "language": "python", 80 | "name": "python3" 81 | }, 82 | "language_info": { 83 | "codemirror_mode": { 84 | "name": "ipython", 85 | "version": 3 86 | }, 87 | "file_extension": ".py", 88 | "mimetype": "text/x-python", 89 | "name": "python", 90 | "nbconvert_exporter": "python", 91 | "pygments_lexer": "ipython3", 92 | "version": "3.6.5" 93 | } 94 | }, 95 | "nbformat": 4, 96 | "nbformat_minor": 1 97 | } 98 | -------------------------------------------------------------------------------- /data/005_32months_T2_RegT1_Reg2Atlas_ManualBrainMask_Stripped.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/005_32months_T2_RegT1_Reg2Atlas_ManualBrainMask_Stripped.nrrd -------------------------------------------------------------------------------- /data/6_Extend_0_Github-SplitComponents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/6_Extend_0_Github-SplitComponents.png -------------------------------------------------------------------------------- /data/6_Extend_1_GitHub-SplitComponents-README.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/6_Extend_1_GitHub-SplitComponents-README.png -------------------------------------------------------------------------------- /data/6_Extend_2_Github-SplitComponents-Edit_and_create_branch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/6_Extend_2_Github-SplitComponents-Edit_and_create_branch.png -------------------------------------------------------------------------------- /data/6_Extend_3_Github-SplitComponents-CreatePR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/6_Extend_3_Github-SplitComponents-CreatePR.png -------------------------------------------------------------------------------- /data/6_Extend_4.5_Github-TwoProjectionRegistration-PR-checks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/6_Extend_4.5_Github-TwoProjectionRegistration-PR-checks.png -------------------------------------------------------------------------------- /data/6_Extend_4_Github-SplitComponents-PR-created.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/6_Extend_4_Github-SplitComponents-PR-created.png -------------------------------------------------------------------------------- /data/6_Extend_5_AzurePipeline-SplitComponents-Builds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/6_Extend_5_AzurePipeline-SplitComponents-Builds.png -------------------------------------------------------------------------------- /data/6_Extend_6_AzurePipeline-SplitComponents-Release.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/6_Extend_6_AzurePipeline-SplitComponents-Release.png -------------------------------------------------------------------------------- /data/6_Extend_7.5_AzurePipeline-TwoProjectionRegistration-ApproveDeploy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/6_Extend_7.5_AzurePipeline-TwoProjectionRegistration-ApproveDeploy.png -------------------------------------------------------------------------------- /data/6_Extend_7_AzurePipeline-SplitComponents-ReleasePipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/6_Extend_7_AzurePipeline-SplitComponents-ReleasePipeline.png -------------------------------------------------------------------------------- /data/6_Extend_8_Pypi-split-components.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/6_Extend_8_Pypi-split-components.png -------------------------------------------------------------------------------- /data/BrainProtonDensitySlice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/BrainProtonDensitySlice.png -------------------------------------------------------------------------------- /data/BrainProtonDensitySliceBorder20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/BrainProtonDensitySliceBorder20.png -------------------------------------------------------------------------------- /data/BrainProtonDensitySliceShifted13x17y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/BrainProtonDensitySliceShifted13x17y.png -------------------------------------------------------------------------------- /data/CBCT-TextureInput.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/CBCT-TextureInput.png -------------------------------------------------------------------------------- /data/CBCT-TextureRunLengthNonUniformity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/CBCT-TextureRunLengthNonUniformity.png -------------------------------------------------------------------------------- /data/CondyleTextureMap.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/CondyleTextureMap.jpeg -------------------------------------------------------------------------------- /data/DzZ_T1.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/DzZ_T1.nrrd -------------------------------------------------------------------------------- /data/DzZ_T2.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/DzZ_T2.nrrd -------------------------------------------------------------------------------- /data/Filtering.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/Filtering.png -------------------------------------------------------------------------------- /data/ForwardAndBackwardTransform.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | Forward and backward transform 21 | 23 | 26 | 31 | 32 | 35 | 40 | 41 | 44 | 49 | 50 | 53 | 58 | 59 | 60 | 82 | 84 | 85 | 87 | image/svg+xml 88 | 90 | Forward and backward transform 91 | 92 | 93 | 94 | 99 | 102 | 107 | 110 | 114 | 119 | 124 | 129 | 134 | 139 | 144 | 149 | 150 | 151 | 152 | 158 | 159 | 162 | 167 | 170 | 174 | 179 | 184 | 189 | 194 | 199 | 204 | 209 | 214 | 215 | 216 | 217 | 223 | 224 | 227 | 232 | 235 | 239 | 244 | 249 | 254 | 259 | 264 | 269 | 274 | 275 | 276 | 277 | 283 | 1 294 | 11 305 | -7 316 | 20 327 | 91 338 | 5 349 | 350 | 353 | 358 | 361 | 365 | 370 | 375 | 380 | 385 | 390 | 395 | 400 | 405 | 406 | 407 | 408 | 414 | ? 425 | ? 436 | ? 447 | ? 458 | ? 469 | ? 480 | ? 491 | ? 502 | 503 | 504 | 505 | -------------------------------------------------------------------------------- /data/KitwareITK.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/KitwareITK.jpg -------------------------------------------------------------------------------- /data/KitwareOverview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/KitwareOverview.jpg -------------------------------------------------------------------------------- /data/Mesh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/Mesh.png -------------------------------------------------------------------------------- /data/PacMan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/PacMan.png -------------------------------------------------------------------------------- /data/PhysicalSpace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/PhysicalSpace.png -------------------------------------------------------------------------------- /data/Registration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/Registration.png -------------------------------------------------------------------------------- /data/Scan_CBCT_13R.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/Scan_CBCT_13R.nrrd -------------------------------------------------------------------------------- /data/SegmC_CBCT_13R.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/SegmC_CBCT_13R.nrrd -------------------------------------------------------------------------------- /data/Segmentation1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/Segmentation1.png -------------------------------------------------------------------------------- /data/Segmentation2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/Segmentation2.png -------------------------------------------------------------------------------- /data/Segmentation3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/Segmentation3.png -------------------------------------------------------------------------------- /data/Segmentation4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/Segmentation4.png -------------------------------------------------------------------------------- /data/Segmentation5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/Segmentation5.png -------------------------------------------------------------------------------- /data/SegmentationLevelSet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/SegmentationLevelSet.png -------------------------------------------------------------------------------- /data/TransformDirection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/TransformDirection.png -------------------------------------------------------------------------------- /data/Transformation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/Transformation.png -------------------------------------------------------------------------------- /data/Ultrasound-B-mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/Ultrasound-B-mode.png -------------------------------------------------------------------------------- /data/VisibleHumanHeadRender.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/VisibleHumanHeadRender.png -------------------------------------------------------------------------------- /data/VisibleHumanLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/VisibleHumanLogo.png -------------------------------------------------------------------------------- /data/VisibleHumanSlice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/VisibleHumanSlice.png -------------------------------------------------------------------------------- /data/WaveletReconstruction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/WaveletReconstruction.png -------------------------------------------------------------------------------- /data/WhiteMatter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/WhiteMatter.png -------------------------------------------------------------------------------- /data/biomechanics.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/biomechanics.jpg -------------------------------------------------------------------------------- /data/brainweb165a10f17.mha: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/brainweb165a10f17.mha -------------------------------------------------------------------------------- /data/carotid-plaque.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/carotid-plaque.gif -------------------------------------------------------------------------------- /data/confidence-connected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/confidence-connected.png -------------------------------------------------------------------------------- /data/connected-threshold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/connected-threshold.png -------------------------------------------------------------------------------- /data/data-pipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/data-pipeline.png -------------------------------------------------------------------------------- /data/dzCBCT.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/dzCBCT.nrrd -------------------------------------------------------------------------------- /data/dzCBCT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/dzCBCT.png -------------------------------------------------------------------------------- /data/dzCT211.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/dzCT211.nrrd -------------------------------------------------------------------------------- /data/dzCT211c.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/dzCT211c.nrrd -------------------------------------------------------------------------------- /data/dzIntensities.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/dzIntensities.png -------------------------------------------------------------------------------- /data/dzIntensitiesCBCT-MRI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/dzIntensitiesCBCT-MRI.png -------------------------------------------------------------------------------- /data/dzMR211.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/dzMR211.nrrd -------------------------------------------------------------------------------- /data/dzTMJ.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/dzTMJ.nrrd -------------------------------------------------------------------------------- /data/dzTMJ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/dzTMJ.png -------------------------------------------------------------------------------- /data/fast-marching-speed-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/fast-marching-speed-image.png -------------------------------------------------------------------------------- /data/fast-marching-time-crossing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/fast-marching-time-crossing.png -------------------------------------------------------------------------------- /data/github-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/github-logo.png -------------------------------------------------------------------------------- /data/isolated-connected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/isolated-connected.png -------------------------------------------------------------------------------- /data/itk-code-reviews.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/itk-code-reviews.png -------------------------------------------------------------------------------- /data/itk-contributors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/itk-contributors.png -------------------------------------------------------------------------------- /data/itk-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/itk-logo.png -------------------------------------------------------------------------------- /data/jupyter-custom.css: -------------------------------------------------------------------------------- 1 | #ipython_notebook img{ 2 | display:block; 3 | background: url(logo.png) no-repeat; 4 | background-size: contain; 5 | width: 124px; 6 | height: 33px; 7 | padding-left: 124px; 8 | -moz-box-sizing: border-box; 9 | box-sizing: border-box; 10 | } 11 | -------------------------------------------------------------------------------- /data/kitware-logo-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/kitware-logo-small.png -------------------------------------------------------------------------------- /data/kitware-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/kitware-logo.png -------------------------------------------------------------------------------- /data/level-set-concept.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/level-set-concept.png -------------------------------------------------------------------------------- /data/level-set-evolution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/level-set-evolution.png -------------------------------------------------------------------------------- /data/pipeline-updates.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/pipeline-updates.png -------------------------------------------------------------------------------- /data/qdna1.mha: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/qdna1.mha -------------------------------------------------------------------------------- /data/segmentation-categories.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/segmentation-categories.png -------------------------------------------------------------------------------- /data/shape-detection-level-set.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/shape-detection-level-set.png -------------------------------------------------------------------------------- /data/shape-detection-pipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/shape-detection-pipeline.png -------------------------------------------------------------------------------- /data/sklearn/im0.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im0.nrrd -------------------------------------------------------------------------------- /data/sklearn/im0_label.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im0_label.nrrd -------------------------------------------------------------------------------- /data/sklearn/im1.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im1.nrrd -------------------------------------------------------------------------------- /data/sklearn/im1_label.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im1_label.nrrd -------------------------------------------------------------------------------- /data/sklearn/im2.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im2.nrrd -------------------------------------------------------------------------------- /data/sklearn/im2_label.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im2_label.nrrd -------------------------------------------------------------------------------- /data/sklearn/im3.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im3.nrrd -------------------------------------------------------------------------------- /data/sklearn/im3_label.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im3_label.nrrd -------------------------------------------------------------------------------- /data/sklearn/im4.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im4.nrrd -------------------------------------------------------------------------------- /data/sklearn/im4_label.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im4_label.nrrd -------------------------------------------------------------------------------- /data/sklearn/im5.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im5.nrrd -------------------------------------------------------------------------------- /data/sklearn/im5_label.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im5_label.nrrd -------------------------------------------------------------------------------- /data/sklearn/im6.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im6.nrrd -------------------------------------------------------------------------------- /data/sklearn/im6_label.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im6_label.nrrd -------------------------------------------------------------------------------- /data/sklearn/im7.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im7.nrrd -------------------------------------------------------------------------------- /data/sklearn/im7_label.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im7_label.nrrd -------------------------------------------------------------------------------- /data/sklearn/im8.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im8.nrrd -------------------------------------------------------------------------------- /data/sklearn/im8_label.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im8_label.nrrd -------------------------------------------------------------------------------- /data/sklearn/im9.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im9.nrrd -------------------------------------------------------------------------------- /data/sklearn/im9_label.nrrd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/sklearn/im9_label.nrrd -------------------------------------------------------------------------------- /data/streaming.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/streaming.gif -------------------------------------------------------------------------------- /data/streaming.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/streaming.png -------------------------------------------------------------------------------- /data/transforms-and-pixels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KitwareMedical/CourseInBiomedicalImageAnalysisAndVisualization/1fb5482fc6e6af7f99304c77af7f2a02134f6734/data/transforms-and-pixels.png -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | docker run \ 4 | -it \ 5 | --rm \ 6 | -p 8888:8888 \ 7 | --user root \ 8 | -e NB_UID=$(id -u) \ 9 | -e NB_GID=$(id -g) \ 10 | -e GRANT_SUDO=yes \ 11 | -v $PWD:/home/jovyan/work \ 12 | thewtex/krs-course:local 13 | -------------------------------------------------------------------------------- /solutions/2_Image_Filtering_Exercise1.py: -------------------------------------------------------------------------------- 1 | fileName = 'data/PacMan.png' 2 | reader = itk.ImageFileReader.New(FileName=fileName) 3 | smoother = itk.RecursiveGaussianImageFilter.New(Input=reader.GetOutput()) 4 | smoother.SetSigma(5.0) 5 | smoother.Update() 6 | view(smoother.GetOutput()) -------------------------------------------------------------------------------- /solutions/2_Image_Filtering_Exercise2.py: -------------------------------------------------------------------------------- 1 | fileName = 'data/PacMan.png' 2 | reader = itk.ImageFileReader.New(FileName=fileName) 3 | smoother = itk.RecursiveGaussianImageFilter.New(Input=reader.GetOutput()) 4 | smoother.SetSigma(5.0) 5 | smoother.Update() 6 | smoother.SetSigma(smoother.GetSigma()) 7 | #smoother.Modified() 8 | smoother.Update() -------------------------------------------------------------------------------- /solutions/2_Image_Filtering_Exercise3.py: -------------------------------------------------------------------------------- 1 | fileName = 'data/PacMan.png' 2 | reader = itk.ImageFileReader.New(FileName=fileName) 3 | smoother = itk.MedianImageFilter.New(Input=reader.GetOutput()) 4 | smoother.SetRadius(5) 5 | smoother.Update() 6 | view(smoother) -------------------------------------------------------------------------------- /solutions/2_Image_Filtering_Exercise4.py: -------------------------------------------------------------------------------- 1 | fileName = 'data/PacMan.png' 2 | reader = itk.ImageFileReader.New(FileName=fileName) 3 | smoother = itk.RecursiveGaussianImageFilter.New(Input=reader.GetOutput()) 4 | writer = itk.ImageFileWriter.New(Input=smoother.GetOutput()) 5 | writer.SetFileName('my_output.jpg') 6 | writer.SetNumberOfStreamDivisions(5) 7 | writer.Update() -------------------------------------------------------------------------------- /solutions/3_Segmentation_Exercise1.py: -------------------------------------------------------------------------------- 1 | input_image = itk.imread('data/BrainProtonDensitySlice.png', itk.ctype('unsigned char')) 2 | connected_threshold = itk.ConnectedThresholdImageFilter.New(input_image) 3 | connected_threshold.SetLower(190) 4 | connected_threshold.SetUpper(255) 5 | connected_threshold.SetReplaceValue( 255 ) 6 | connected_threshold.SetSeed( [100, 110] ); 7 | connected_threshold.Update() 8 | 9 | view(connected_threshold) -------------------------------------------------------------------------------- /solutions/3_Segmentation_Exercise2.py: -------------------------------------------------------------------------------- 1 | input_image = itk.imread('data/BrainProtonDensitySlice.png', itk.ctype('unsigned char')) 2 | isolated_connected = itk.IsolatedConnectedImageFilter.New(input_image) 3 | isolated_connected.SetSeed1([98, 112]) 4 | isolated_connected.SetSeed2([98, 136]) 5 | isolated_connected.SetUpperValueLimit( 245 ) 6 | isolated_connected.FindUpperThresholdOff(); 7 | isolated_connected.Update() 8 | 9 | view(isolated_connected) -------------------------------------------------------------------------------- /solutions/3_Segmentation_Exercise3.py: -------------------------------------------------------------------------------- 1 | line = 0 2 | 3 | if line == 0: 4 | basin_minimum = 1 5 | boundary_minimum = 5.0 6 | propagation_scaling = 1.0 7 | curvature_scaling = 2.0 8 | number_of_iterations = 100 9 | elif line == 1: 10 | basin_minimum = 1 11 | boundary_minimum = 5.0 12 | propagation_scaling = 1.0 13 | curvature_scaling = 2.0 14 | number_of_iterations = 500 15 | elif line == 2: 16 | basin_minimum = 1 17 | boundary_minimum = 5.0 18 | propagation_scaling = 1.0 19 | curvature_scaling = 4.0 20 | number_of_iterations = 100 21 | else: 22 | basin_minimum = 1 23 | boundary_minimum = 20.0 24 | propagation_scaling = 1.0 25 | curvature_scaling = 1.0 26 | number_of_iterations = 100 27 | 28 | explore_shape_detection_image_parameters(basin_minimum, boundary_minimum, 29 | propagation_scaling, curvature_scaling, number_of_iterations) -------------------------------------------------------------------------------- /solutions/4_ITK_and_NumPy_answers_Exercise1.py: -------------------------------------------------------------------------------- 1 | import itk 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | %matplotlib inline 5 | 6 | im=itk.imread('data/CBCT-TextureInput.png', itk.F) 7 | sobel=itk.sobel_edge_detection_image_filter(im) 8 | arr = itk.array_from_image(sobel) 9 | plt.gray() 10 | plt.imshow(arr) 11 | plt.axis('off') 12 | -------------------------------------------------------------------------------- /solutions/4_ITK_and_NumPy_answers_Exercise2.py: -------------------------------------------------------------------------------- 1 | import itk 2 | import numpy as np 3 | 4 | im=itk.imread('data/KitwareITK.jpg', itk.UC) 5 | arr = itk.array_from_image(im) 6 | arr[0,0] 7 | print("Pixel in array: %f"%arr[0,0]) 8 | arr[0,0]=125 9 | print("Pixel in array: %f"%arr[0,0]) 10 | print("Pixel in image: %f"%im.GetPixel([0,0])) 11 | -------------------------------------------------------------------------------- /solutions/4_Using_ITK_in_Python_real_world_filters_MeanFilter-TypeDeduction.py: -------------------------------------------------------------------------------- 1 | mean_filter = itk.MeanImageFilter.New(image, radius=5) 2 | mean_filter.Update() 3 | mean_filtered_image = mean_filter.GetOutput() 4 | view(mean_filtered_image) -------------------------------------------------------------------------------- /solutions/4_Using_ITK_in_Python_real_world_filters_MeanFilter.py: -------------------------------------------------------------------------------- 1 | mean_filter = itk.MeanImageFilter[ImageType, ImageType].New() 2 | mean_filter.SetInput(image) 3 | mean_filter.SetRadius(5) 4 | mean_filter.Update() 5 | mean_filtered_image = mean_filter.GetOutput() 6 | view(mean_filtered_image) -------------------------------------------------------------------------------- /solutions/4_Using_ITK_in_Python_real_world_filters_MedianFilter.py: -------------------------------------------------------------------------------- 1 | median_filter = itk.MedianImageFilter[ImageType, ImageType].New() 2 | median_filter.SetInput(image) 3 | median_filter.SetRadius(5) 4 | median_filter.Update() 5 | median_filtered_image = median_filter.GetOutput() 6 | view(median_filtered_image) -------------------------------------------------------------------------------- /solutions/4_Using_ITK_in_Python_real_world_filters_OtsuFilter-TypeDeduction.py: -------------------------------------------------------------------------------- 1 | otsu_filter = itk.OtsuThresholdImageFilter.New(image) 2 | otsu_filter.Update() 3 | otsu_filtered_image = otsu_filter.GetOutput() 4 | print(otsu_filtered_image) -------------------------------------------------------------------------------- /solutions/4_Using_ITK_in_Python_real_world_filters_OtsuFilter.py: -------------------------------------------------------------------------------- 1 | InputImageType = itk.Image[itk.ctype('float'), 2] 2 | OutputImageType = itk.Image[itk.ctype('short'), 2] 3 | 4 | otsu_filter = itk.OtsuThresholdImageFilter[InputImageType, OutputImageType].New() 5 | otsu_filter.SetInput(image) 6 | otsu_filter.Update() 7 | otsu_filtered_image = otsu_filter.GetOutput() 8 | view(otsu_filtered_image) -------------------------------------------------------------------------------- /solutions/4_Using_ITK_in_Python_real_world_filters_mean.py: -------------------------------------------------------------------------------- 1 | mean_filtered_image = itk.mean_image_filter(image, radius = 5) 2 | view(mean_filtered_image) -------------------------------------------------------------------------------- /solutions/4_Using_ITK_in_Python_real_world_filters_median.py: -------------------------------------------------------------------------------- 1 | median_filtered_image = itk.median_image_filter(image, radius = 5) 2 | view(median_filtered_image) -------------------------------------------------------------------------------- /solutions/4_Using_ITK_in_Python_real_world_filters_otsu.py: -------------------------------------------------------------------------------- 1 | otsu_filtered_image = itk.otsu_threshold_image_filter(image) 2 | view(otsu_filtered_image) -------------------------------------------------------------------------------- /solutions/5_Registration_Exercise2Answer1.py: -------------------------------------------------------------------------------- 1 | registration = itk.ImageRegistrationMethodv4.New(FixedImage=fixedImage, 2 | MovingImage=movingImage, 3 | Metric=metric, 4 | Optimizer=optimizer, 5 | InitialTransform=initialTransform) -------------------------------------------------------------------------------- /solutions/5_Registration_Exercise2Answer2.py: -------------------------------------------------------------------------------- 1 | resampler = itk.ResampleImageFilter.New(Input=movingImage, 2 | Transform=outputCompositeTransform, 3 | UseReferenceImage=True, 4 | ReferenceImage=fixedImage) -------------------------------------------------------------------------------- /solutions/5_Registration_Exercise4Answer.py: -------------------------------------------------------------------------------- 1 | initialParameters[0] = 0.0 # rotation in radians 2 | initialParameters[1] = -40.0 # x translation in millimeters 3 | initialParameters[2] = +30.0 # y translation in millimeters -------------------------------------------------------------------------------- /solutions/6_Extending_the_toolkit_exercise.py: -------------------------------------------------------------------------------- 1 | textures = itk.coocurrence_texture_features_image_filter(image, 2 | mask_image=mask, 3 | number_of_bins_per_axis=10, 4 | histogram_minimum=0, 5 | histogram_maximum=4200, 6 | neighborhood_radius=6) 7 | texture_array = itk.array_view_from_image(textures) 8 | view(texture_array[:,:,:,1].reshape(texture_array.shape[:-1]).copy(), mode='z', cmap='jet') 9 | -------------------------------------------------------------------------------- /solutions/6_Extending_the_toolkit_exercise1.py: -------------------------------------------------------------------------------- 1 | #* Open a Notebook terminal (New->Terminal) 2 | #* If the folder is already there, remove it: 3 | # rm -rf ITKModuleTemplate 4 | #* Create new module 5 | # python -m cookiecutter gh:InsightSoftwareConsortium/ITKModuleTemplate --no-input 6 | #* Explore module 7 | # cd ITKModuleTemplate 8 | # ls 9 | -------------------------------------------------------------------------------- /solutions/6_Extending_the_toolkit_exercise2.py: -------------------------------------------------------------------------------- 1 | #* Open a Notebook terminal (New->Terminal) 2 | #* Explore module code 3 | # cd ITKModuleTemplate 4 | # ls 5 | # cd include/ 6 | # ls 7 | #* Look at `itkMyFilter.hxx` 8 | #* Modify `itkMyFilter.hxx` --------------------------------------------------------------------------------