Skip to main content

SimpleITK is a simplified interface to the Insight Toolkit (ITK) for image registration and segmentation

Project description

What is SimpleElastix?

Image registration is the process of transforming images into a common coordinate system so corresponding pixels represent homologous biological points. SimpleElastix is an extension of SimpleITK that offers a user-friendly API to the popular image registration algorithms of the elastix C++ library. This makes state-of-the-art medical image registration really easy to do in languages like Python, Java, C# and R. This package provides

  • elastix and transformix bindings for C++, Python, Java, R, Ruby, Octave, Lua, Tcl and C# (see elastix manual for a list of supported registration algorithms).
  • Pre-configured registration methods that work well in many cases and serve as starting points for tuning elastix to domain-specific applications.
  • Installation guides, examples, and introductory material at simpleelastix.readthedocs.org.
  • A user-friendly API that aligns with the design philosophy of SimpleITK developed specifically for rapid prototyping. If you are interested, The Design of SimpleITK is a great read.
  • The complete set of SimpleITK image processing algorithms.

Enough talk, time for some examples! We will use Python for the following code. Say you need to register two images. This can be accomplished with a single line of code:

resultImage = SimpleITK.Elastix(sitk.ReadImage("fixedImage.dcm"), sitk.ReadImage("movingImage.dcm"))

Under the hood, Elastix will use stochastic optimization for maximum speed, a multi-resolution strategy and several different transforms of increasing complexity for maximum robustness. All aspects of the registration procedure can be customized via parameter maps.

SimpleElastix can also be used for more complex image processing pipelines. Say you want to compare the volume, mean intensity and standard deviation of the intensity of anatomical structures across a population of images using an atlas segmentation. We can accomplish this task with the following lines of Python code:

import SimpleITK as sitk

# The atlas and associated segmentation is loaded once and held in memory
movingImage = sitk.ReadImage('atlasImage.hdr')
movingLabel = sitk.ReadImage('atlasLabel.hdr')

# Images are loaded from disk one at a time. Here we specify an array of 
# paths to images which we will loop over. 
population = ['image1.dcm', 'image2.dcm', ... , 'imageN.dcm']

selx = sitk.ElastixImageFilter()
selx.SetMovingImage(movingImage)
selx.SetParameterMap(selx.GetDefaultParameterMap('nonrigid'))

for filename in population
  # Register images
  fixedImage = sitk.ReadImage(filename)
  selx.SetFixedImage(fixedImage)
  selx.Execute()

  # Transform label map using the deformation field from above
  resultLabel = sitk.Transformix(movingLabel, selx.GetTransformParameterMap())

  # Compute statistics for label 1
  LabelStatistics = sitk.LabelStatisticsImageFilter()
  LabelStatistics.Execute(fixedImage, sitk.Cast(resultLabel, sitk.sitkInt8))
  LabelStatistics.GetCount(1)
  LabelStatistics.GetMean(1)
  LabelStatistics.GetVariance(1)
  # etc etc

This example demonstrates the efficiency of combining SimpleElastix's object oriented interface (the way we used elastix to register images) and procedural interface (the way we used transformix to warp labels) with SimpleITK (the way we computed statistics). Previously, using elastix and transformix on large datasets would incur a significant overhead, from scripting command line invocations and arguments to copying images and transform parameter files across folders. With SimpleElastix this complexity is easier to manage and more memory and disk I/O efficient. For more examples see the documentation.

Building with the SuperBuild

SimpleElastix integrates elastix and transformix with the SimpleITK SuperBuild. Simply clone this repository and invoke the SuperBuild as outlined in the documentation. The SuperBuild will download and install dependencies (elastix, ITK, SimpleITK and SWIG) and compile SimpleElastix. Target language dependencies need to be pre-installed, e.g. sudo apt-get install cmake swig monodevelop r-base r-base-dev ruby ruby-dev python python-dev tcl tcl-dev tk tk-dev. Note that this project takes around an hour to build on a quad-core machine.

The documentation further describes how to build SimpleElastix on Windows and how to build SimpleElastix manually without the SuperBuild.

SimpleElastix has been tried and tested on Ubuntu 14.10 using GCC 4.9.2 and Clang 3.4.0, Mac OSX Yosemite using Apple Clang 600.0.56 and Windows 8.1 using Microsft Visual Studio 2012 C++ compiler.

About

If you are interested in my work you are most welcome to visit my website.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

SimpleITK_SimpleElastix-2.0.2rc2.dev788-cp311-cp311-macosx_12_0_arm64.whl (48.0 MB view details)

Uploaded CPython 3.11macOS 12.0+ ARM64

SimpleITK_SimpleElastix-2.0.2rc2.dev788-cp310-cp310-macosx_12_0_arm64.whl (47.8 MB view details)

Uploaded CPython 3.10macOS 12.0+ ARM64

SimpleITK_SimpleElastix-2.0.2rc2.dev788-cp39-cp39-macosx_12_0_arm64.whl (47.8 MB view details)

Uploaded CPython 3.9macOS 12.0+ ARM64

SimpleITK_SimpleElastix-2.0.2rc2.dev788-cp38-cp38-macosx_12_0_arm64.whl (47.8 MB view details)

Uploaded CPython 3.8macOS 12.0+ ARM64

File details

Details for the file SimpleITK_SimpleElastix-2.0.2rc2.dev788-cp311-cp311-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for SimpleITK_SimpleElastix-2.0.2rc2.dev788-cp311-cp311-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 bb6e3c7457a65dcf5539934ec14268c27a8ca7aae92883fdd1895161bfd123d2
MD5 03bc60df2069fcab6e4d677e8a3e713b
BLAKE2b-256 48c7f7774ce16e92f32d814ba6648f5559262fd7e0d6a12f9a71e30c07df6e01

See more details on using hashes here.

File details

Details for the file SimpleITK_SimpleElastix-2.0.2rc2.dev788-cp310-cp310-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for SimpleITK_SimpleElastix-2.0.2rc2.dev788-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 5ee8278ad1888448625a29413a5d7fd68b950fdc5bdd6cfd95ea6c198433d58b
MD5 96e91844c250f3625700e695b0a32520
BLAKE2b-256 c9f7d5495f06e0d7868c01602a77573ef35734bd5962d36b4f802b7076e6dd6a

See more details on using hashes here.

File details

Details for the file SimpleITK_SimpleElastix-2.0.2rc2.dev788-cp39-cp39-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for SimpleITK_SimpleElastix-2.0.2rc2.dev788-cp39-cp39-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 0a688af60124ac4c42c3c92eea6accdd395bd715bff82be890522eda27bf16c7
MD5 0d0255acbe2d4cb56fb5cca1961f0ce3
BLAKE2b-256 ee835f5430772fab9dd3f14bac404797d1304aa14cff371d266531a2032f6512

See more details on using hashes here.

File details

Details for the file SimpleITK_SimpleElastix-2.0.2rc2.dev788-cp38-cp38-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for SimpleITK_SimpleElastix-2.0.2rc2.dev788-cp38-cp38-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 38a816d28eec0e5e90ec78e0a8fdf2ba0247822f1c234439fc496852838d3012
MD5 ae5b7f1dd8e816358178f2ad676a926e
BLAKE2b-256 973d062f97605b0cc12108b2d2a381a2a5bae14ec07a2a00dc29fa0a315de21e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page