Reading group - 22/05/2013

Post on 08-Jul-2015

80 views 4 download

description

Slides from the reading group presentation where I introduced a new Python interface for IRTK. See http://kevin-keraudren.blogspot.co.uk/2013/12/irtk-python.html for more details and the iPython notebook demo.

Transcript of Reading group - 22/05/2013

Organ Detection in Fetal MRI

Kevin KeraudrenImperial College London

May 22nd, 2013

1 Overview

2 Python interface for IRTK

3 Future work

2/27

1 Overview

2 Python interface for IRTK

3 Future work

3/27

Overview

1 Brain detection &reconstruction

2 3D visualisation

3 Organ localisation

4/27

People

Brain reconstruction:Maria Murgasova

3D visualisation:Christina Malamateniou

Organ detection:Bernhard Kainz

5/27

Localisation of the Brain in Fetal MRI UsingBundled SIFT Features

For every slice Detect MSER regions Filter by size

Classify using SIFT features

RANSAC

6/27

Detections results averaged over the crossvalidation (all orientations combined)

Error (mm)Centiles 2D SIFT 3D SIFT Bundled SIFT

25th 10.9 14.8 4.050th 15.5 20.8 5.775th 20.5 30.4 8.4

Detection 98% 85% 100%Complete brain 38% 23% 85%

7/27

1 Overview

2 Python interface for IRTK

3 Future work

8/27

Why Python?

ls *.nii | python -c ’import sys, irtk;[sys.stdout.write( str(irtk.imread(line.rstrip(),dtype="float32").max())+"\n")for line in sys.stdin]’

numpy, matplotlib, OpenCV, VTK, scipy.ndimage...

& C++ via cython

9/27

Why another library?

import itk

pixelType = itk.UCimageType = itk.Image[pixelType, 3]readerType = itk.ImageFileReader[imageType]writerType = itk.ImageFileWriter[imageType]reader = readerType.New()reader.SetFileName( "input.nii" )reader.Update()

itk2np = itk.PyBuffer[imageType]data = itk2np.GetArrayFromImage( reader.GetOutput() )

...

10/27

Why another library?

import SimpleITK as sitk

img = sitk.ReadImage( "input.nii" )data = sitk.GetArrayFromImage( img )

...

output = sitk.GetImageFromArray( data )output.SetSpacing( img.GetSpacing() )output.SetOrigin( img.GetOrigin() )output.SetDirection( img.GetDirection() )sitk.WriteImage( output, "output.nii" )

11/27

Why another library?

import irtk

img = irtk.imread( "input.nii" )

...

irtk.imwrite( "output.nii", img )

12/27

Key features

simple and pythonic

overload getitem instead of GetRegion

parallelisation using joblib

visualisation functions

13/27

Implementation

template <class dtype>void irtk2py( irtkGenericImage<dtype>& irtk_image,

dtype* img,double* pixelSize,double* xAxis,double* yAxis,double* zAxis,double* origin,int* dim );

14/27

Implementation

void py2rigid( irtkRigidTransformation &transform,double tx,double ty,double tz,double rx,double ry,double rz,bool invert=false );

15/27

Demo

ipython notebook

16/27

Parallelisation example

import irtk from joblib import Parallel, delayed from glob import glob def register( f, img1): img2 = irtk.imread( f, dtype=’float32’) img2 = img2.rescale().resample(2) t = img2.register(img1) return t

filenames = glob( raw_folder + "/" + patient_id + "_*.nii") img1 = irtk.imread(filenames[0], dtype=’float32’) img1 = img1.rescale().resample(2) transformations = [irtk.RigidTransformation()] transformations.extend( Parallel(n_jobs=-1)(delayed(register)(f, img1) for f in filenames[1:] ) )

17/27

1 Overview

2 Python interface for IRTK

3 Future work

18/27

Coarse segmentation as side product of detection

19/27

Convex hull of all detections

20/27

Iterative detection/reconstruction

21/27

Iterative detection/reconstruction

22/27

Iterative detection/reconstruction

23/27

Room for improvement

Refine motion model (statistics on slice transformations)

Patch based segmentation instead of graphcut

Detect head orientation to solve more difficult registrations

Could the detection process producemore than a mask?

24/27

Could we reconstruct more than the brain?

25/27

For the future (hanging projects)

Spine detection using SLIC supervoxels

Dense volumetric features: SURF 3D

Alignment of mothers’ bodies to model of a pregnant woman

26/27

Suggestions or questions?

27/27