methods in medical image analysis

62
Methods In Medical Image Analysis Theoretical & practical skills in medical image analysis Imaging modalities Segmentation Registration Visualization Image understanding Established methods and current research

Upload: tayte

Post on 23-Feb-2016

78 views

Category:

Documents


1 download

DESCRIPTION

Methods In Medical Image Analysis. Theoretical & practical skills in medical image analysis  Imaging modalities  Segmentation  Registration  Visualization  Image understanding  Established methods and current research. Why Is Medical Image Analysis Special ?. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Methods In Medical  Image Analysis

Methods In Medical Image Analysis

• Theoretical & practical skills in medical image analysis– Imaging modalities– Segmentation– Registration– Visualization– Image understanding

• Established methods and current research

Page 2: Methods In Medical  Image Analysis

Why Is Medical Image Analysis Special?

• Because of the patient• Computer Vision:

– Good at detecting irregulars, e.g. on the factory floor– But no two patients are alike--everyone is “irregular”

• Medicine is war– Radiology is primarily for reconnaissance– Surgeons are the marines– Life/death decisions made on insufficient information

• Success measured by patient recovery• You’re not in “theory land” anymore

Page 3: Methods In Medical  Image Analysis

What Do I Mean by Analysis?

• Different from “Image Processing”• Results in identification, measurement, and/or

judgment• Produces numbers, words, & actions• Holy Grail: complete image understanding

automated within a computer to perform diagnosis & control robotic intervention

• State of the art: segmentation & registration

Page 4: Methods In Medical  Image Analysis

Segmentation• Labeling every voxel• Discrete vs. fuzzy• How good are such labels?

– Gray matter (circuits) vs. white matter (cables).– Tremendous oversimplification

• Requires a model

Page 5: Methods In Medical  Image Analysis

Registration

• Image to Image– same vs. different imaging modality– same vs. different patient– topological variation

• Image to Model– deformable models

• Model to Model– matching graphs

Page 6: Methods In Medical  Image Analysis

Visualization

• Visualization used to mean to picture in the mind.• Retina is a 2D device• Analysis needed to visualize surfaces• Doctors prefer slices to renderings• Visualization is required to reach visual cortex• Computers have an advantage over humans in 3D

Page 7: Methods In Medical  Image Analysis

Model of a Modern Radiologist

Page 8: Methods In Medical  Image Analysis

How Are We Going to Do This?

• The Shadow Program– Observe & interact w/ practicing radiologists

• Project oriented– C++ & ITK– National Library of Medicine Insight Toolkit– A software library developed by a consortium of

institutions including the University of Pittsburgh– Open source– Large online community– www.itk.org

Page 9: Methods In Medical  Image Analysis

The Practice of AutomatedMedical Image Analysis

• A collection of recipes, a box of tools– Equations that function: crafting human thought.– ITK is a library, not a program.

• Solutions:– Computer programs (fully- and semi-automated).– Very application-specific, no general solution.– Supervision / apprenticeship of machines

Page 10: Methods In Medical  Image Analysis

Anatomical Axes

• Superior = head• Inferior = feet

• Anterior = front• Posterior = back

• Proximal = central• Distal = peripheral

Page 11: Methods In Medical  Image Analysis

Imaging Modalities

• Camera• X-Ray• CT• Ultrasound• MRI• …

Page 12: Methods In Medical  Image Analysis

1896: The X-Ray

Wilhelm Röntgen

Page 13: Methods In Medical  Image Analysis

X-Ray and Fluoroscopic Images

• Projection of X-Ray silhouette onto a piece of film or detector array, with intervening fluorescent screen

Page 14: Methods In Medical  Image Analysis

Computerized Tomography

• From a series of projections, a tomographic image is reconstructed using Filtered Back Projection.

Page 15: Methods In Medical  Image Analysis

Nuclear Medicine

• Previously discussed imaging modalities image anatomy (structure).

• Nuclear medicine images physiology (function)– At the cellular (and subcellular) level– Technically a type of molecular imaging– Requires use of radioactive pharmaceuticals

Page 16: Methods In Medical  Image Analysis

SPECT• Single Photon Emission Computed Tomography• Gamma camera for creating image of radioactive target• Camera is rotated around patient

Page 17: Methods In Medical  Image Analysis

Positron Emission Tomography• Positron-emitting organic compounds create pairs of high

energy photons that are detected synchronously. No collimators, greater sensitivity. Attenuation is not location dependent, so quantification is possible.

Page 18: Methods In Medical  Image Analysis

Phased Array Ultrasound

• Images anatomy

• Ultrasound beam formed and steered by controlling the delay between the elements of the transducer array

Page 19: Methods In Medical  Image Analysis

Real Time 3D Ultrasound

Page 20: Methods In Medical  Image Analysis

Other Imaging Modalities

• MRI & fMRI• OCT (“optical ultrasound”)• Pathology (in addition to Radiology)• Other modalities coming down the pike

Page 21: Methods In Medical  Image Analysis

Current Trends in Imaging

• 3D, 4D, …• Higher speed• Greater resolution• Measure function as well as structure• Combining modalities (including direct vision)

Page 22: Methods In Medical  Image Analysis

The Gold Standard

• Dissection:– Medical School, Day 1:• Meet the Cadaver.

– From Vesalius to the Visible Human

Page 23: Methods In Medical  Image Analysis

A brief C++ review

• Review of object oriented programming– Inheritance & polymorphism– Public / private / protected derivation

• Review of generic programming– templates• templated classes• specialization

– typedef & typename keywords

Page 24: Methods In Medical  Image Analysis

Namespaces

• Namespaces solve the problem of classes that have the same name

• E.g., ITK contains an Array class, perhaps your favorite add-on toolkit does too

• You can avoid conflicts by creating your own namespace around codenamespace itk { code }

Page 25: Methods In Medical  Image Analysis

Namespaces, cont.

• Within a given namespace, you refer to other classes in the same namespace by their name only, e.g. inside the itk namespace Array means “use the ITK array”

• Outside of the namespace, you use the itk:: prefix, e.g. itk::Array

• Only code which is part of ITK itself should be inside the itk namespace

• At minimum, youʼre always in the global namespace

Page 26: Methods In Medical  Image Analysis

Namespaces, cont.

• Note that code within the itk namespace should refer to code outside of the namespace explicitly

• E.g. use std::cout instead of cout

Page 27: Methods In Medical  Image Analysis

Object-oriented programming

• Identify functional units in your design • Write classes to implement these functional

units– Preferably as “black boxes”

• Separate functionality as much as possible to promote code re-use

Page 28: Methods In Medical  Image Analysis

Class membership

• Classes have member variables and methods– ITK names class member variables with the “m_”

prefix, as in “m_VariableName”• Class members are 1 of 3 types– Public– Private– Protected

Page 29: Methods In Medical  Image Analysis

Public membership

• Everyone can access the member– The rest of the world– The class itself– Child classes

• You should avoid making member variables public, in order to prevent undesired modification.– A black box shouldnʼt have openings

Page 30: Methods In Medical  Image Analysis

Private membership

• Only the class itself can access the member– Itʼs not visible to the rest of the world– Child classes canʼt access it either

Page 31: Methods In Medical  Image Analysis

Protected membership

• The middle ground between public and private– The outside world canʼt access it… but derived classes can

Page 32: Methods In Medical  Image Analysis

ITK and membership

• In ITK, member variables are almost always private• There are public accessor functions that allow the

rest of the world to get and set the value of the private member

• This ensures that the class knows when the value of a variable changes

Page 33: Methods In Medical  Image Analysis

Why do it this way?

• Consider a filter class - if someone changes a variable in the filter, it should re-run itself the next time the user asks for output

• If nothing has changed, it doesnʼt waste time running again

• Accessor functions set a “modified flag” to notify the framework when things have changed

Page 34: Methods In Medical  Image Analysis

Inheritance in a nutshell

• Pull common functionality into a base class• Implement specific functionality in derived classes• Donʼt re-invent the wheel!• Base classes = parents• Derived classes = children

Page 35: Methods In Medical  Image Analysis

Overloading

• If a child class re-implements a function from the base class, it “overloads” the function

• You can use this to change the behavior of a function in the child class, while preserving the global interface

Page 36: Methods In Medical  Image Analysis

An example of inheritance ina graphical drawing program

• Shape– Polygon

• Triangle• Quadrilateral

– Rectangle– Trapezoid– Rhombus

• Pentagon– ConicSection

• Ellipse– Circle

• Parabola

Page 37: Methods In Medical  Image Analysis

An example of ITK inheritance

• itk::DataObject– itk::ImageBase< VImageDimension >• itk::Image< TPixel, VImageDimension>

Page 38: Methods In Medical  Image Analysis

Virtual functions

• Virtual functions allow you to declare functions that “might” or “must” be in child classes

• You can specify (and use) a virtual function without knowing how it will be implemented in child classes

Page 39: Methods In Medical  Image Analysis

Virtual functions, cont.

• The “=0” declaration means that the function must be implemented in a child class

• This allows for polymorphism• For example:– virtual void DrawSelf() = 0;

Page 40: Methods In Medical  Image Analysis

Example of polymorphism ina graphical drawing program

• Shape: DrawSelf() = 0;– Polygon: int vertices; DrawSelf() connects vertices with line

segments• Triangle: vertices=3• Quadrilateral: vertices=4

– Rectangle– Trapezoid– Rhombus

• Pentagon: vertices=5– ConicSection

• Ellipse: DrawSelf() uses semimajor and semiminor axes– Circle: forces length semiminor axis = length semimajor

• Parabola

Page 41: Methods In Medical  Image Analysis

Generic programming

• Generic programming encourages:– Writing code without reference to a specific data type

(float, int, etc.)– Designing code in the most “abstract” manner possible

• Why?– Trades a little extra design time for greatly improved re-

usability

Page 42: Methods In Medical  Image Analysis

Image example

• Images are usually stored as arrays of a particular data type– e.g. unsigned char[256*256]

• Itʼs convenient to wrap this array inside an image class (good object oriented design)

• Allowing the user to change the image size is easy with dynamically allocated arrays

Page 43: Methods In Medical  Image Analysis

Image example, cont.

• Unfortunately, changing the data type isnot so easy• Typically you make a design choice and live with it

(most common)• Or, youʼre forced to implement a double class, a float

class, an int class, and so on (less common, complicated)

Page 44: Methods In Medical  Image Analysis

Templates to the rescue

• Templates provide a way out of the data type quandary

• If youʼre familiar with macros, you can think of templates as macros on steroids

• With templates, you design classes to handle an arbitrary “type”

Page 45: Methods In Medical  Image Analysis

Anatomy of a templated class

• template <class TPixel, unsigned int VImageDimension=2>class ITK_EXPORT Image : public ImageBase<VImageDimension>

• Template keyword, the < >’s enclose template parameters

Page 46: Methods In Medical  Image Analysis

Anatomy of a templated class

• template <class TPixel, unsigned int VImageDimension=2>class ITK_EXPORT Image : public ImageBase<VImageDimension>

• TPixel is a class (of some sort)

Page 47: Methods In Medical  Image Analysis

Anatomy of a templated class

• template <class TPixel, unsigned int VImageDimension=2>class ITK_EXPORT Image : public ImageBase<VImageDimension>

• VImageDimension is an unsigned int, with a default value of 2

Page 48: Methods In Medical  Image Analysis

Anatomy of a templated class

• template <class TPixel, unsigned int VImageDimension=2>class ITK_EXPORT Image : public ImageBase<VImageDimension>

• Image is the name of this class

Page 49: Methods In Medical  Image Analysis

Anatomy of a templated class

• template <class TPixel, unsigned int VImageDimension=2>class ITK_EXPORT Image : public ImageBase<VImageDimension>

• Image is derived from ImageBase in a public manner

Page 50: Methods In Medical  Image Analysis

Specialization

• When you specify all of the template parameters, you “fully specialize” the class

• In the previous example, ImageBase<VImageDimension> specializes the base class by specifying its template parameter. Note that the VImageDimension parameter is actually “passed through” from Imageʼs template parameters

Page 51: Methods In Medical  Image Analysis

Derivation from templated classes

• You must specify all template parameters of the base class

• The template parameters of the base class may or may not be linked to template parameters of the derived class

• You can derive a non-templated class from a templated one if you want to (by hard coding all of the template parameters)

Page 52: Methods In Medical  Image Analysis

Templated class instances

• To create an instance of a templated class, you must fully specialize it

• E.g. itk::Image<int, 3> myImage; Creates a 3D image of integers• (not quite true, but we can pretend it does until we cover

smart pointers)

Page 53: Methods In Medical  Image Analysis

Alas…

• C++ actually allows partial specialization• For example, you write an Image class that must be

3D, but still templates the pixel type (or vice-versa)• Unfortunately, not all compilers support this (VS.net

2003+ does, newer GCCs too)

Page 54: Methods In Medical  Image Analysis

Typedefs

• One consequence of templates is that the names of a fully defined type may be quite long

E.g. itk::Image<itk::MyObject<3, double>, 3>

might be a legal type

Page 55: Methods In Medical  Image Analysis

Typedefs cont.

• You can create a user-defined type by using the typedef keyword

typedef itk::Image<int, 3> 3DIntImageType;3DIntImageType myImage;3DIntImageType anotherImage;

Page 56: Methods In Medical  Image Analysis

Fun with typedefs

• Typedefs can be global members of classes and accessed as such

typedef itk::Image<double, 3> OutputType; OutputType::Pointer im = filter1.GetOutput();• In template classes, member typedefs are often

defined in terms of template parameters - no problem! This is actually quite handy.

typedef itk::Image<TPixel, 3> InputType;

Page 57: Methods In Medical  Image Analysis

Naming of templates and typedefs

• ITK uses the following conventions:– Template parameters are indicated by T(for type) or V (for

value). E.g. TPixel means “the type of the pixel” and VImageDimension means “value template parameter image dimension”

– Defined types are named as FooType. E.g. CharImage5DType

Page 58: Methods In Medical  Image Analysis

Be careful

• If youʼre careless in naming classes, template arguments, typedefs, and member variables (with the “m_” prefix) it can be quite difficult to tell them apart! Donʼt write a new language using typedefs.

• Remember to comment well and donʼt use obscure names; e.g. BPType is bad, BoundaryPointType is good

Page 59: Methods In Medical  Image Analysis

Typenames• typename is a keyword you will learn to dislike• Think of it as existing to optionally help the compiler• Different compilers handle it differently• In general, you can take it to mean that its target is

“some sort of type, but youʼre not sure what kind”

• For example:typename SomeType typeInstance;

• “typename” tells the compiler that SomeType is the name of a valid type, and not just a nonsense word

Page 60: Methods In Medical  Image Analysis

Typenames, cont.

• Mac and Windows seem to largely ignore typenames - in fact, some Mac compilers insist theyʼre “deprecated”

• On Linux, you may need to preface template parameter types with typename

• My advice: try adding typename

Page 61: Methods In Medical  Image Analysis

.txx, .cxx, .h

• ITK uses three standard file extensions, and so should you:– .h files indicate a class header file– .cxx indicates either• a) executable code (an example, test, demo, etc.)• b) a non-templated class implementation

– .txx indicates a templated class implementation

Page 62: Methods In Medical  Image Analysis

Final advice

• If you run across something in ITK you donʼt understand, donʼt panic– Be careful not to confuse typedefs with classes – Error messages can be quite long with templates and will

take time to get used to• Learning the style of C++ used by ITK is at least half

of the battle