Medical Visualization with ITK - Scientific Computing and Imaging ...

Medical Visualization with ITK - Scientific Computing and Imaging ... Medical Visualization with ITK - Scientific Computing and Imaging ...

28.06.2014 Views

Medical Visualization Introduction to Segmentation with ITK Josh Cates with the Insight Consortium

<strong>Medical</strong> <strong>Visualization</strong><br />

Introduction to Segmentation <strong>with</strong> <strong>ITK</strong><br />

Josh Cates<br />

<strong>with</strong> the Insight Consortium


Goals<br />

Supplement Software Guide <strong>with</strong> theory, ideas,<br />

<strong>and</strong> examples.<br />

Assembling applications from <strong>ITK</strong> components<br />

• GUIs<br />

• <strong>Visualization</strong><br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


<strong>Medical</strong> Image Segmentation<br />

Partitioning images into meaningful pieces,<br />

e.g. delineating regions of anatomical<br />

interest.<br />

Huge area of research<br />

Some common approaches<br />

• Edge based – find boundaries between<br />

regions<br />

• Region based – similarity of pixels <strong>with</strong>in a<br />

segment<br />

• Pixel classification – metrics classify regions<br />

(e.g. tissue types)<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Seg. in <strong>ITK</strong>: An Image Processing Pipeline<br />

Preprocessing<br />

Raw Data<br />

Filtering<br />

linear<br />

nonlinear<br />

Feature<br />

Extraction<br />

differential geom.<br />

edge detection<br />

<strong>ITK</strong> segmentation filters are not<br />

complete applications –<br />

components in a pipeline.<br />

How <strong>ITK</strong> filters fit together<br />

to produce segmentation pipelines.<br />

Segmentation<br />

<strong>Visualization</strong><br />

region growing<br />

binary volume<br />

watersheds<br />

meshes<br />

level-sets<br />

labeled image<br />

implicit surfaces<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Seg. in <strong>ITK</strong>: An Image Processing Pipeline<br />

Raw Data<br />

Filtering<br />

User<br />

Interface<br />

Feature<br />

Extraction<br />

Segmentation<br />

<strong>Visualization</strong><br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Features of <strong>ITK</strong> Filters<br />

Most filters are N dimensional<br />

• Image = volume<br />

• Pixel = voxel<br />

Data type matters – cast if necessary<br />

Watch spacing – resample if necessary<br />

Read filter's documentation<br />

● And send feedback!<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Preprocessing for Segmentation<br />

Importance of Preprocessing<br />

• Data filtering is part of segmentation<br />

­ Cropping<br />

­ Resampling<br />

­ Seed points, regions<br />

• Filtering introduces “hidden parameters”<br />

­ Requires expertise<br />

­ Tuned for application<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Preprocessing for Segmentation<br />

Goals of Preprocessing<br />

• Prepare data for segmentation<br />

• Remove noise & uninteresting detail –<br />

downsample / blur<br />

• Target interesting information – crop, seed<br />

points<br />

• Preserve <strong>and</strong> extract features – edges<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Linear vs. Nonlinear Diffusion<br />

Gaussian blurring<br />

• Convolution framework<br />

• Recursive Gaussian<br />

• Accuracy / Speed tradeoffs<br />

Nonlinear diffusion<br />

• PDE framework<br />

• Anisotropic, curvature­limited, bilateral<br />

● P. Perona, J. Malik, Scale-space <strong>and</strong> edge detection using anisotropic diffusion,<br />

IEEE Transactions on Pattern Analysis Machine Intelligence 12 (1990) 629–639.<br />

● R. Whitaker, X. Xue. Variable-Conductance, Level-Set Curvature for Image<br />

Processing. International Conference on Image Processing. IEEE, 2001.<br />

● Tomasi, M<strong>and</strong>uchi. Bilateral Filtering for Gray <strong>and</strong> Color Images. IEEE ICCV. 1998.<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Linear Diffusion<br />

Destroys <strong>and</strong> moves edges<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Nonlinear Diffusion<br />

Preserves Edges<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Underst<strong>and</strong>ing <strong>and</strong> Using <strong>ITK</strong> Segment. Filters<br />

✔<br />

Region Growing<br />

✔<br />

Morphological Watersheds<br />

✔<br />

✔<br />

Level Set Methods<br />

Combination Methods – extend seg. pipeline<br />

Other algorithms available!<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Segmentation Applications – Ideas & Examples<br />

✔<br />

Interactive Level Sets <strong>with</strong> Fltk<br />

✔<br />

User­assisted Watersheds <strong>with</strong> Tcl <strong>and</strong> VTK<br />

✔<br />

Validation Work<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Region Growing<br />

Idea<br />

• Start <strong>with</strong> set of seed pixels – region<br />

• Iteratively include neighboring pixels that<br />

satisfy membership criteria<br />

Membership criteria – similarity based metrics<br />

• Intensity interval<br />

• Regional statistics<br />

Flood­fill algorithms<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Region Growing Filters in <strong>ITK</strong><br />

http://www.itk.org/itkSoftwareGuide.pdf<br />

Connected Threshold<br />

• Include pixels inside intensity interval<br />

Neighborhood Connected<br />

• More conservative – includes pixels only if<br />

all pixel neighbors are inside an interval<br />

Fuzzy Connectedness<br />

• Statistical method assigns affinities between<br />

pixels<br />

• Combines classification & region approach<br />

● J. Udupa, S. Samarasekera. “Fuzzy connectedness <strong>and</strong> object definition: Theory,<br />

algorithms, <strong>and</strong> applications in image segmentation.” Graphical Models in Image<br />

Processing, 58(3): 246-261, 1996<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Confidence Connected Filter<br />

Threshold based region growing<br />

Mean <strong>and</strong> st<strong>and</strong>ard deviation of region<br />

determine upper <strong>and</strong> lower thresholds<br />

Recomputes thresholds at intervals<br />

Compute m <strong>and</strong> s<br />

of region<br />

Flood fill <strong>with</strong> threshold interval<br />

[m-ks, m+ks]<br />

Repeat N times<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Example: Confidence Connected Filter<br />

Examples/Segmentation/ConfidenceConnected.cxx<br />

input file<br />

name<br />

iterations<br />

time step<br />

iterations<br />

multiplier<br />

seed point<br />

output file<br />

name<br />

Image<br />

Reader<br />

Curvature<br />

Flow<br />

(smoothing)<br />

Confidence<br />

Connected<br />

Image<br />

Writer<br />

Scalar<br />

Image<br />

Binary<br />

Image<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Example: Confidence Connected Filter<br />

Examples/Data/BrainProtonDensitySlice.png<br />

original<br />

white matter<br />

(60,116)<br />

ventricle<br />

(81,112)<br />

gray matter<br />

(107,69)<br />

smoothing iterations 5<br />

smoothing time step 0.125<br />

C.C. multiplier 2.5<br />

C.C. iterations 5<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Morphological Watersheds<br />

Large body of research over 20 years<br />

Inspired by hydrology – treat image as<br />

l<strong>and</strong>scape <strong>and</strong> look for watersheds<br />

Watershed Transform – alg. that identifies<br />

watershed regions<br />

Main Variations<br />

✔ Top­down: classify pixels by shortest<br />

topological distance to local minima<br />

✗<br />

Bottom­up: simulated immersion algorithms<br />

● L. Vincent, P. Soille,Watersheds in digital spaces: An efficient algorithm based on<br />

immersion simulations, PAMI 13 (6) (1991) 583–598.<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


<strong>ITK</strong> Watershed Transform<br />

Image treated as a topological relief map –<br />

intensity represents height<br />

Gradient descent defines segmented regions<br />

• Set of all pixels whose paths of steepest<br />

descent terminate in same local minimum<br />

• Bounded by image features<br />

Global – operates on entire image at once<br />

“No parameters”<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


The Watershed Transform<br />

Image (filtered)<br />

Feature Extraction<br />

“Edge Map”<br />

Watershed Transform<br />

Watershed Depth<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


The Oversegmentation Problem<br />

Watershed transform produces too many<br />

regions<br />

• One per local minimum<br />

• Especially in noisy or highly detailed data<br />

To alleviate oversegmentation<br />

✗<br />

✔<br />

Immersion alg. from marker points<br />

Hierarchical approach – merge adjacent<br />

regions according to increasing watershed<br />

depth<br />

● A. P. Mangan, R. T. Whitaker, Partitioning 3D surface meshes using watershed<br />

segmentation, IEEE Transactions on <strong>Visualization</strong> <strong>and</strong> Computer Graphics 5 (4)<br />

(1999) 308–321.<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Watersheds Hierarchy<br />

Enforce minimum watershed depths<br />

at successively higher levels.<br />

Watershed Depth Threshold<br />

Oversegmented Undersegmented<br />

Watershed Transform<br />

= basin<br />

Boolean Operations<br />

On Sub-trees<br />

(e.g. user interaction)<br />

Initial Watershed<br />

Transform<br />

Watershed Depth<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Hierarchy Level 1<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Hierarchy Level 2<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


itk::WatershedImageFilter<br />

Watershed Image Filter<br />

Height<br />

image<br />

Segmenter<br />

(watershed<br />

transform)<br />

Catchment<br />

Basins<br />

Image<br />

relabeler<br />

Labeled<br />

image<br />

Lower Thresholding<br />

Process object<br />

Data object<br />

Parameter<br />

Hierarchy<br />

generator<br />

Hierarchy<br />

Maximum Watershed Depth<br />

Output Depth (Level)<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Example: Morphological Watersheds<br />

Examples/Segmentation/WatershedSegmentation1.cxx<br />

file<br />

name<br />

iterations<br />

conductance<br />

time step<br />

level<br />

threshold<br />

file<br />

name<br />

Image<br />

Reader<br />

Vector<br />

Cast<br />

Anisotropic<br />

Diffusion<br />

Gradient<br />

Magnitude<br />

WS<br />

Image<br />

Filter<br />

“Colorizer”<br />

Image<br />

Writer<br />

RGB<br />

Image<br />

labeled<br />

Image<br />

(u. long)<br />

RGB<br />

Image<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Watershed Filter Output<br />

Output level recomputes real­time<br />

Format<br />

• Labeled N dimensional image<br />

• Unsigned long integers<br />

• Potentially large number of values!<br />

<strong>Visualization</strong>?<br />

• Contour lines<br />

• Map to RGB<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Mapping Labels to RGB for <strong>Visualization</strong><br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Constructing a “Colorizing” Filter<br />

Input<br />

Image<br />

(unsigned<br />

long)<br />

Unary Functor<br />

Image Filter<br />

ScalarToRGB<br />

Functor<br />

Output<br />

Image<br />

(RGB)<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Setting Watersheds Parameters<br />

original image<br />

Diffusion<br />

Iterations<br />

Watershed Depth (Level)<br />

10<br />

15<br />

0.01<br />

0.02 0.03 0.04 0.05 0.06<br />

20<br />

conductance 1.0<br />

lower threshold 0.0<br />

30<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Setting Watersheds Parameters<br />

Watershed Depth (Level)<br />

original<br />

image<br />

0.01<br />

0.02<br />

0.03<br />

conductance 1.0<br />

diffusion iterations 10<br />

lower threshold 0.0<br />

0.04<br />

0.05<br />

0.06<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Setting Watershed Parameters<br />

Lower Threshold<br />

0.00001 0.00010 0.00100 0.01000 0.10000<br />

original<br />

image<br />

Diffusion Conductance<br />

0.25 0.50 1.00 1.25 1.50 2.00<br />

diffusion iterations 10<br />

level 0.03<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Generating Models<br />

Extract Segmented Regions<br />

• Thresholding, connected components<br />

• Produce binary volumes<br />

<strong>Visualization</strong><br />

• Overlays<br />

• Surface Rendering<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Watersheds GUI Design<br />

InsightApplications/SegmentationEditor<br />

User<br />

Tk Graphical User Interface<br />

Tcl Wrapper<br />

vtk<strong>ITK</strong> IP Pipeline<br />

VTK Vis. Pipeline<br />

}<br />

Input<br />

Data<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Demo: Watersheds GUI<br />

Watershed<br />

transform<br />

Data <strong>with</strong><br />

overlay<br />

Segmentation<br />

in progress<br />

Sliders manipulate<br />

watershed depth<br />

<strong>and</strong> position in the<br />

hierarchy.<br />

3D isosurface<br />

rendering<br />

Watershed Depth Threshold<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


vtk<strong>ITK</strong><br />

InsightApplications/vtk<strong>ITK</strong><br />

Mechanism for converting <strong>ITK</strong> filters into VTK<br />

filters<br />

VTK wrapped for Python, Tcl, Java<br />

VTK<br />

Image<br />

VTK Image Import<br />

vtk<strong>ITK</strong>ImageToImageFilter<br />

<strong>ITK</strong><br />

Image<br />

<strong>ITK</strong> Filter<br />

<strong>ITK</strong><br />

Image<br />

VTK Image Export<br />

VTK<br />

Image<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Validation: User Study<br />

Comparison of user-assisted hierarchical<br />

watersheds <strong>with</strong> h<strong>and</strong>-contouring<br />

H<strong>and</strong> contouring<br />

• De facto st<strong>and</strong>ard<br />

• General <strong>and</strong> reliable(?)<br />

Issues<br />

• Can a general purpose segmentation<br />

algorithm compete?<br />

• (Are our validation tools up to the task?)<br />

Cates, Whitaker, Jones, “Case Study: An Evaluation Of User­Assisted Hierarchical<br />

Watershed Segmentation”, <strong>Medical</strong> Image Analysis, Under review.<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


User Study Overview<br />

MRI Brain Tumor<br />

(4 cases)<br />

Ground Truth<br />

Subjects (Slicer)<br />

Slice from HBW BT<br />

database (4 per<br />

case)<br />

WS Segmentation<br />

Subjects<br />

Radiologists (3) from<br />

Univ of Utah<br />

VHP Cryosection<br />

(Eyeball, optic nerve,<br />

lateral rectus)<br />

3rd­year med.<br />

students at HBW<br />

<strong>and</strong> Utah (EB–4,<br />

ON–3, LR–8)<br />

3rd­year med.<br />

students at Utah (7)<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Validation Strategy<br />

Experts<br />

H<strong>and</strong> Contouring<br />

STAPLE<br />

Ground<br />

Truth<br />

User Studies<br />

WS<br />

(RR vs Full)<br />

Benchmark<br />

Performance<br />

Parameters<br />

Accuracy<br />

Precision<br />

Efficiency<br />

WS<br />

Performance<br />

Parameters<br />

Analysis<br />

Conclusions<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Validation Results<br />

Eyeball<br />

Optic nerves<br />

Data H<strong>and</strong> contour Watersheds<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Validation Results<br />

H<strong>and</strong> contour<br />

Watersheds<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Validation Results<br />

Brain tumor MRI<br />

Visible Human cryosections<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Summary of Validation Results<br />

Accuracy<br />

• Sensitivity (TPF) is generally low<br />

• Total correct fraction generally <strong>with</strong>in variation of<br />

experts (better for tumor data)<br />

• Generally better than level-set approach<br />

Precision<br />

• Significantly better than both h<strong>and</strong> contouring <strong>and</strong><br />

level­set<br />

Efficiency<br />

• Versus h<strong>and</strong> contouring, no comparison (30 min<br />

vs. 2­3 hours)<br />

• Versus level­set, more preprocessing <strong>and</strong><br />

comparable user times<br />

• Time/expertise to tune hidden parameters issue<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Validation Conclusions<br />

Watershed Segmentation<br />

• WS probably makes more sense vs h<strong>and</strong><br />

contouring in many applications<br />

• True positive fraction is an issue – could<br />

tune for that metric<br />

Validation<br />

• Rich set of systematic tools<br />

• Pixel­based – shape metrics lacking<br />

• H<strong>and</strong> contouring for ground truth<br />

questionable<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Level­Set Surface Modeling Theory<br />

k th Level Set: set of all points of value k<br />

Embed N dimensional surface as Zero level set<br />

of N+1 dim. volume <br />

Model N dim. surface movement as an evolving<br />

wavefront – forward differences solution to<br />

PDE<br />

t<br />

=−F∣∇ ∣<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Segmentation Using Level Sets<br />

Define speed term(s) to go to zero at edges –<br />

data fitting term<br />

Surface motion/speed based on image features<br />

or intensity<br />

Solve the level­set equation where<br />

F =Speed −Curvature<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Insight PDE Solver Framework<br />

Purpose<br />

• Nonlinear image processing – e.g.<br />

anisotropic diffusion<br />

• Moving wave fronts – level set models<br />

• Deformable registration<br />

Generic framework<br />

• Separate solvers from equations –<br />

interchangeable code objects<br />

• Focus on infrastructure & include instances /<br />

examples in the toolkit<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


PDE Solver Hierarchy<br />

Finite Difference<br />

Solver<br />

Finite Difference<br />

Function<br />

Dense<br />

Narrow<br />

B<strong>and</strong><br />

Sparse<br />

Threaded<br />

Sparse<br />

Diffusion<br />

Level<br />

Set<br />

Segment.<br />

Diffusion<br />

Deform.<br />

Registration<br />

Other Solvers<br />

Aniso. Diff Curv.<br />

Limited<br />

Other Functions<br />

4 th Order<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Constructing a PDE Filter<br />

Subclass solver for application – parameters,<br />

convergence criteria<br />

Virtual method plugs in function object<br />

Typically only need a header file<br />

Input<br />

Image<br />

Solver Object Subclass<br />

Function<br />

Object<br />

Output<br />

Image<br />

(Filtered)<br />

Parameters<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Anisotropic Diffusion Framework<br />

Finite Difference Solver<br />

Finite Difference Solver<br />

Dense Solver<br />

Anisotropic Diffusion Filter<br />

User-Defined Diffusion Filter<br />

Diffusion<br />

Function<br />

Input<br />

Image<br />

Perona-<br />

Malik<br />

Function<br />

Curvature-<br />

Limited<br />

Function<br />

Vector-<br />

Valued<br />

Function<br />

Output<br />

Image<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Level­Set Segmentation Framework<br />

Sparse or Narrowb<strong>and</strong> solver<br />

Base LS function<br />

• Generic equation<br />

• Virtual Speed Term methods<br />

Combine different Speed terms in plug <strong>and</strong> play<br />

manner<br />

Speed:<br />

Data Fitting<br />

Term<br />

Regularization/<br />

Smoothing<br />

Surface<br />

Motion/<br />

Segmentation<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Level­Set Segmentation Framework<br />

Finite Difference Solver<br />

Finite Difference Solver<br />

Sparse-Field Level-Set Solver<br />

“Feature”<br />

Image<br />

Level-Set Segmentation Filter<br />

Curvature<br />

Function<br />

User-Defined LS Seg. Filter<br />

Level Set<br />

Function<br />

Output<br />

Model<br />

Initial<br />

Model<br />

Shape<br />

Detection<br />

Function<br />

Canny<br />

Edges<br />

Function<br />

Active-<br />

Contours<br />

Function<br />

Laplacian<br />

Function<br />

Threshold<br />

Function<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Example: Threshold­based LS Segmentation<br />

Speed function (positive inside object)<br />

Similar to confidence connected filter<br />

Points Outside<br />

Points Inside<br />

Points Outside<br />

Model Speed<br />

Image Intensity<br />

Low<br />

Threshold<br />

High<br />

Threshold<br />

•Lefohn, Kniss, Hansen, Whitaker, “GPU­Based, Interactive, Level­Set Models for Volume<br />

<strong>Visualization</strong> <strong>and</strong> Analysis”, IEEE Vis 2003<br />

•Lefohn, Whitaker, Cates, “Interactive Level­Set Models for Brain Tumor Segmentation”,<br />

MICCAI 2003<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Example: Level­Set Segmentation<br />

Examples/Segmentation/ThresholdSegmentationLevelSetImageFilter.cxx<br />

Fast<br />

Marching<br />

OR<br />

Image<br />

Reader<br />

seed<br />

indicies<br />

Image<br />

Reader<br />

distance to<br />

surface from<br />

seeds<br />

LS<br />

Segment.<br />

Filter<br />

file<br />

name<br />

Image<br />

Writer<br />

LS<br />

Image<br />

(float)<br />

Initial<br />

model<br />

Feature<br />

Image<br />

number of iterations<br />

maximum rms change<br />

curvature scale<br />

feature scale<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Level­Set Filter Output<br />

Format<br />

• Floating point<br />

• Zero isosurface<br />

t<br />

• Inside negative, outside positive<br />

Visualize?<br />

• Render zero isosurface<br />

• Zero crossing – color map, overlays<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Example:Isosurface Overlays in VTK<br />

InsightApplications/LevelSetSegmentation/vtkViewOutput.tcl<br />

Speed<br />

Image<br />

Image<br />

Reader<br />

Resampler<br />

Image<br />

Mapper<br />

LS<br />

Image<br />

Image<br />

Reader<br />

Threshold<br />

Filter<br />

Resampler<br />

Image<br />

Mapper<br />

2D<br />

Actor<br />

Viewer<br />

Original<br />

Image<br />

Image<br />

Reader<br />

Resampler<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Example: Level­Set Segmentation Results<br />

Original<br />

White matter Ventricle Gray matter<br />

(60,116)<br />

150<br />

180<br />

(81,112)<br />

210<br />

250<br />

(107,69)<br />

180<br />

210<br />

: Seed Point<br />

: Lower thresh.<br />

: Upper thresh.<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Interactive Level Sets<br />

InsightApplications/ThresholdSegmentationLevelSetFltkGUI<br />

User<br />

<strong>ITK</strong> IP Pipeline<br />

Fltk Graphical User Interface<br />

OpenGL Vis.<br />

}<br />

Input<br />

Data<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Fast Light Toolkit (Fltk)<br />

Cross­platform, open­source C++ GUI toolkit<br />

● Windows, Linux / Unix (X11), MacOS X<br />

GNU Library General Public License (LGPL)<br />

(more restrictive than <strong>ITK</strong> license)<br />

Includes “Fluid” UI builder application<br />

<strong>ITK</strong> image viewer widgets<br />

● InsightApplications/Auxiliary/FltkImageViewer<br />

VTK – Fltk interface code<br />

● http://vtkfltk.sourceforge.net/<br />

http://www.fltk.org<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Threshold LS Segmentation Demo<br />

Interface to segmentation pipeline<br />

Setting parameters<br />

Effects of curvature<br />

<strong>Visualization</strong><br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Event H<strong>and</strong>ling in <strong>ITK</strong><br />

Comm<strong>and</strong> / Observer design pattern – generic<br />

callback mechanism<br />

Comm<strong>and</strong>s are registered as observers of a<br />

filter's events<br />

Filters invoke events, triggering comm<strong>and</strong><br />

execution<br />

User Code<br />

MyComm<strong>and</strong><br />

Execute()<br />

AddObserver(IterationEvent(), MyComm<strong>and</strong>)<br />

<strong>ITK</strong> Filter<br />

...<br />

InvokeEvent(IterationEvent())<br />

InvokeEvent(ProgressEvent())<br />

...<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


How To Visualize Evolving Level­Set Surfaces<br />

See: InsightApplications/ThresholdSegmentationLevelSetFltkGUI/SegmenterConsole.cxx<br />

Write an <strong>ITK</strong> Comm<strong>and</strong> object to render LS filter<br />

output<br />

● Be sure to detach output from pipeline, use SetPixelContainer<br />

Register your comm<strong>and</strong> as observer of LS<br />

filter's IterationEvent()<br />

myRenderComm<strong>and</strong><br />

itk::image::Pointer output<br />

output -> SetPixelContainer(myFilter->GetOutput())<br />

Render(output)<br />

GUI Code<br />

myFilter->AddObserver(IterationEvent(), myRenderComm<strong>and</strong>)<br />

Level-Set Filter<br />

“myFilter”<br />

...<br />

InvokeEvent(IterationEvent())<br />

...<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Example: Multiscale 3D Segmentation<br />

Scale<br />

Seed surface<br />

Data<br />

1/4<br />

1/2<br />

1/1<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Advanced Features in the PDE Framework<br />

Parallel Solvers – Narrowb<strong>and</strong>, Sparse field<br />

Speedup<br />

(vs. 1 processor<br />

50<br />

45<br />

40<br />

35<br />

30<br />

25<br />

20<br />

15<br />

10<br />

5<br />

0<br />

SGI Origin 3000<br />

64 600 Mhz Processors<br />

0 20 40 60<br />

Number of processors<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Surface Processing <strong>with</strong> 4 th Order PDEs<br />

Isotropic<br />

Anisotropic<br />

•T. Tasdizen, R. Whitaker, P. Burchard, S. Osher, “Geometric Surface Smoothing via<br />

Anisotropic Diffusion of Normals”, Proc. IEEE <strong>Visualization</strong> 2002, pp. 125–132.<br />

•T. Tasdizen, R. Whitaker, P. Burchard, S. Osher, “Geometric surface processing via normal<br />

maps”, To appear: ACM Trans. on Graphics.<br />

•T. Tasdizen, R. Whitaker, “Higher-Order Geometric Surface Priors for Surface Estimation”,<br />

IEEE Trans. on Pattern Analysis <strong>and</strong> Machine Intelligence, To appear.<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


4 th Order Flow Segmentation Framework<br />

Sparse-Field Level-Set Solver<br />

(Refitting)<br />

Finite Difference Solver<br />

Finite Difference Solver<br />

Manifold Solver<br />

(Normals Processing)<br />

Input<br />

Image<br />

Level-Set Segmentation Filter<br />

Curvature<br />

Function<br />

User-Defined LS Seg. Filter<br />

Speed<br />

Function<br />

Initial<br />

Model<br />

Shape<br />

Detection<br />

Function<br />

Canny<br />

Edges<br />

Function<br />

Active-<br />

Contours<br />

Function<br />

LaPlacian<br />

Function<br />

Output<br />

Model<br />

Threshold<br />

Function<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Segmentation Using 4 th Order Flows<br />

Speed term only<br />

Speed + Anisotropic<br />

4 th order terms<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Recent Development – CVS<br />

LS Solvers interchangeable at run­time<br />

• Choose between sparse­field, parallel, <strong>and</strong><br />

4 th order<br />

Stop / Start capability for solvers<br />

• Optionally maintains state between updates<br />

Better access to speed function<br />

• Supports user interface development<br />

• Optionally precalculate<br />

• Plug user speed function into base filter<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Example: Combining Segmentation Filters<br />

Generate initial model using confidence<br />

connected filter<br />

Fit to data using level­set methods – minimize<br />

distance to Canny edges<br />

Confidence<br />

Connected<br />

Initial<br />

model<br />

Feature<br />

Image<br />

Canny LS<br />

Segmentation<br />

Filter<br />

LS<br />

Image<br />

(float)<br />

Image<br />

Anisotropic<br />

Diffusion<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Harvard Brigham & Womens Tumor Database<br />

HBW Surgical Planning Lab<br />

T1 MRI brain tumor patients<br />

from clinical database.<br />

Includes meningioma, low-grade<br />

glioma, astrocytoma.<br />

Case 1: Left-frontal meningioma<br />

Warfield, Nabavi, Butz, Tuncali, Silverman, “Intraoperative segmentation <strong>and</strong> nonrigid<br />

registration for image guided therapy, in: MICCAI'2000, SpringerVerlag, 2000, pp.176­<br />

185.<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Confidence Connected + Level­Set Result<br />

Initial confidenceconnected<br />

result<br />

LS Speed Term: distance<br />

from Canny edges<br />

Post-processing <strong>with</strong><br />

Canny LS segmenter<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


Acknowledgements<br />

Ross Whitaker, Tolga Tazdizen, Darby Van Uitert,<br />

Suyash Awate, Xinwei Xue: Utah <strong>ITK</strong> Team.<br />

Drs Simon Warfield, Michael Kaus, Ron Kikinis, Peter<br />

Black, <strong>and</strong> Ferenc Jolesz: Brain tumor database.<br />

Greg Jones & Drs Steve Stevens, Troy Marlow, Jay<br />

Tsuruda, Peter Ratiu: Validation Study.<br />

National Library of Medicine<br />

Insight Users<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah


More Information...<br />

enjoy <strong>ITK</strong>!<br />

http://www.itk.org<br />

http://www.sci.utah.edu/~cates<br />

<strong>Scientific</strong> <strong>Computing</strong> <strong>and</strong> <strong>Imaging</strong> Institute, University of Utah

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!