Giter Site home page Giter Site logo

adizhol / simpleelastix Goto Github PK

View Code? Open in Web Editor NEW

This project forked from superelastix/simpleelastix

0.0 1.0 0.0 13.6 MB

User-friendly medical image registration library

Home Page: http://simpleelastix.readthedocs.org

License: Apache License 2.0

Shell 1.16% CMake 4.62% C++ 72.01% C 10.87% Python 6.05% Lua 0.73% C# 0.34% Java 0.22% Ruby 0.09% R 0.57% Tcl 0.03% Groovy 0.16% Makefile 0.25% TeX 2.90%

simpleelastix's Introduction

What is SimpleElastix?

The goal of SimpleElastix is to bring the robust C++ medical image registration algorithms of the elastix library to a wider audience by integrating elastix with SimpleITK. Image registration is the process of transforming images into a common coordinate system so corresponding pixels represent homologous biological points. This is a prerequisite for a wide range of medical image analysis tasks and a key algorithmic component for statistical analysis and machine learning in medical image processing. This package provides

  • elastix and transformix bindings for Python, Java, R, Ruby, Octave, Lua, Tcl and C# (see elastix manual for a list of supported registration algorithms).
  • Installation, examples, usage and introductory material at simpleelastix.readthedocs.org.
  • A user-friendly API that aligns with the design philosophy of SimpleITK, developed specifically for rapid prototyping and use in scripting languages. If you are interested, The Design of SimpleITK is a great read.
  • Pre-configured parameter files that should serve as good starting points for new users.
  • A SuperBuild that automatically compiles and installs SimpleElastix and any dependencies.
  • The complete set of SimpleITK image processing algorithms.

Enough talk, time for some examples! Say you need to compare the volume, mean intensity and standard deviation of (possibly multiple) anatomical structures across a population of images using an atlas segmentation. This is accomplished using 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.hdr', 'image2.hdr', ... , 'imageN.hdr']

selx = sitk.SimpleElastix()
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.GetTransformParameterMapList())

  # 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

That was easy. The 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 or the Examples/SimpleElastix directory.

Building with the SuperBuild

SimpleElastix integrates elastix and transformix with the SimpleITK SuperBuild. Simply clone this repository and invoke the SuperBuild.

git clone https://github.com/kaspermarstal/SimpleElastix
mkdir build
cd build
cmake ../SimpleElastix/SuperBuild
make -j4

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.

simpleelastix's People

Contributors

blowekamp avatar gabehart avatar blezek avatar dave3d avatar thewtex avatar kaspermarstal avatar danmuel avatar dlrdave avatar hjmjohnson avatar zivy avatar aghayoor avatar richardbeare avatar bradking avatar daviddoria avatar jcfr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.