Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Lecture 10 – part 2, Medical Image Analysis and Programming Tools No suggested problem... Magnus Gedda [email protected] 20050428 1 Programming for Image Analysis/Processing • Tools and guidelines for writing your own image analysis/processing applications – What is needed when you start a project – Tools to help you along the way 2 What you need to start • Choice of environment depends on – Image format – Algorithm(s) – Data structures – Graphical user interface (GUI) – Performance requirements 3 Image format • File – TIFF, JPG, GIF, PNG, BMP, ... – Raw files – “Exotic” format • Dimensions – 2D – 3D – More (colour, time, features, ...) 4 Algorithms and data structures • Typical data structures – Arrays (images) – Stacks and queues (e.g., region growing) – Graphs, trees, lists, ... • Typical algorithms – Convolution – Numerical (e.g., integration) – Transforms (e.g., FFT) – Geometry (e.g., convex hull) 5 GUI • Does the application require user interaction? 6 Some available tools • Survival kit for “nonserious” image processing • Matlab • ITK • ImageJ • There are a lot of other possibilites out there (often customized for application) 7 Survival kit • View – XV (*nix freeware) – IrfanView (Win freeware) • Convert – ImageMagick (Mac/*nix freeware) • Manipulate, create (and convert) – Adobe Photoshop (Win/Mac commercial) – Paint Shop Pro (Win shareware) – The Gimp (Win/Mac/*nix open source) 8 The Gimp • • • • • Photoshoplike www.gimp.org Open source with big community Plugins Developed on Unix platform. Windows version is a port. • No real CMYK handling (bad for Desktop Publishing) 9 Matlab • MATrix LABoratory – Optimized for matrix computations – “No for loops” • • • www.mathworks.com Image Processing Toolbox Commercial – Matlab 8.000 SEK – IP Toolbox 3.500 SEK – Complete Matlab 30.000 SEK 10 Matlab IO • File formats – JPG, TIFF, GIF, PNG, BMP, ... – Support for DICOM fid=fopen(‘file.raw','r') img=fread(fid_in,'uchar'); img=reshape(img,x,y,z); – Raw files • imread, imwrite – I=imread('imagename.tif','tif') – imwrite(I,'imagename.tif','tif') • Image acquisition toolbox – Direct feed from cameras, microscopes, ... 11 Matlab – Basic functions • Image arithmetics – Operate directly on matrices: +, , ... – Work with uint8, uint16 data: imadd, imsubstract, … • Image enhancement – Change brightness/contrast: imadjust – Histogram equalisation: histeq 12 Matlab – Basic functions • Geometric transformations – imrotate, imcrop – imtransform (affine, projective, ...) • Resizing, interpolation – imresize – Interpolation methods • Nearest (neighbour) • Bilinear (2x2), bicubic (4x4) • Spline (if Spline toolbox installed) 13 Matlab – Basic functions • Feature extraction – Linear filtering: filter2 – Classical edge operators: edge f=fspecial('gaussian'); bilg=filter2(f,bil)); bilEdge=edge(bil,'sobel'); 14 Matlab Advanced • • • • • Filtering (FIR filter creation – SP toolbox) Inverse filtering (restoration) Image transforms (FFT, PCA, ...) Binary and greyscale morphology Segmentation – Watershed (also on color images) 15 Matlab Visualization • 2D display – – imshow imagesc • 3D surface rendering – isosurface, patch – isocaps, isonormals – ... 16 Matlab GUI 17 Matlab More • Integration capabilities – Matlab C compiler – JAVA • Pros and cons + Easy to learn + All basic tools in IP toolbox + Multiplatform (*.m scripts) Memory handling (double) [Matlab7 uses single] Only optimal for “vectorizable” algorithms + Ndimensional 18 Matlab Usage • Prototyping of programs • Easy for advanced 2D • Simple 3D 19 ImageJ • Originally developed on Mac for cell analysis of microscopic images (NIH image) • rsb.info.nih.gov • Open source (public domain) 20 ImageJ IO • File formats – TIF (even 16 bits), GIF, JPG, Raw, ... – Support for DICOM via plugin • Lots of plugins for different microscopes 21 ImageJ – Basic functions • Image enhancement • Image measurements – ROI tools: draw, count, measure • Edge extraction, binary & grayscale morphology 22 ImageJ Extensions • Add plugin in JAVA – TransformJ: geometric transformations – FeatureJ: gradient, 2nd derivative, … – VolumeJ: volume renderer – ... • Scripting language (record function + edit script) • Use ImageJ as a toolbox within another applet 23 ImageJ – Pros and cons + JAVA: easy to learn + JAVA: runs on all platforms + Open source: FREE + Extensions by JAVA plugins or scripting Data type not originally meant for 3D 24 ImageJ Usage • Complete userinterfaced solution • Easy for midadvanced 2D • Simple 3D 25 ITK • NLM Insight Segmentation & Registration Toolkit • Project at the National Library of Medicine (at NIH) • Goals – Support the Visible Human Project – Create a repository of fundamental algorithms – Develop a platform for advanced product development – Grow a selfsustaining community of software users and developers 26 ITK – Principles • The data pipeline File Reader Image Gaussian Image Writer File • Generic programming with templates – ITK images are Ndimensional – ITK handles arbitrary pixel type 27 ITK – Available algorithms • Binary and grayscale morphology – Watershed • Partial differential equations methods – Anisotropic diffusion filters – Level sets, fast marching See IA MN2 • Advanced data structures – Mesh, point clouds, vector images 28 ITK – Extensions • • • • Write new filters GUI: fltk, QT, Windows MFC Visualisation: VTK Scripting: Tcl, Python, JAVA 29 ITK – Pros and cons + Growing and very active community + Can handle Ndimensional data + Open Source: FREE + Very advanced algorithms Steep learning curve No builtin GUI 30 ITK – Usage • Serious IA/IP needs • Multidimensional algorithms • Speed (C++ on image buffers) • Prototyping IA/IP programs using scripting languages 31