Image Analysis Using R Chris Campbell LondonR - 13th July 2010 Steps to image analysis • Image capture • Clean image/reduce noise • Extract information • Analyze information Image Capture Light Photography gels Light microscopy cells Fluorescence microscopy tissue samples http:// ... western blot http:// ... cells Image Capture Light Photography gels Light microscopy cells Fluorescence microscopy tissue samples Radiography bones Computed tomography (CT) tumours X-ray http:// ... x-ray http:// ... cat scan Image Capture Light Photography gels Light microscopy cells Fluorescence microscopy tissue samples Radiography bones Computed tomography tumours Magnetic resonance imaging (MRI) patients X-ray Magnetism http:// ... MRI Image Capture Light Photography gels Light microscopy cells Fluorescence microscopy tissue samples Radiography bones Computed tomography tumours Magnetic resonance imaging patients Scanning electron microscopy insects Transmission electron microscopy viruses X-ray Magnetism Electrons http:// ... SEM insect http:// ... TEM virus Image Capture Light Photography gels Light microscopy cells Fluorescence microscopy tissue samples Radiography bones Computed tomography tumours Magnetic resonance imaging patients Scanning electron microscopy insects Transmission electron microscopy viruses Positron emission tomography tumours X-ray Magnetism Electrons Positrons (PET) http:// ... positron emission tomography Image Capture Light Photography gels Light microscopy cells Fluorescence microscopy tissue samples Radiography bones Computed tomography tumours Magnetic resonance imaging patients Scanning electron microscopy insects Transmission electron microscopy viruses Positron emission tomography tumours X-ray Magnetism Electrons Positrons Intermolecular forces (PET) Atomichttp://pico.iis.u-tokyo.ac.jp/media/16/20060621-QuenchedSi-AFM.jpg force microscopy inorganic surfaces Generally… • Use large numbers of images • Use all images • Use whole image, not crop • Random selection not "typical region" • i.e. avoid subjectivity Image Processing Libraries in CRAN biOps Image processing and analysis dcemri A Package for Medical Image Analysis dpmixsim Dirichlet Process Mixture model simulation for clustering & image segmentation edci Edge Detection and Clustering in Images epsi Edge Preserving Smoothing for Images FITSio FITS (Flexible Image Transport System) utilities PET Simulation and Reconstruction of PET Images R4dfp 4dfp MRI Image Read & Write Routines rimage Image Processing Module for R RImageJ R bindings for ImageJ ripa R Image Processing & Analysis tractor.base A package for reading, manipulating & visualising magnetic resonance images adimpro Adaptive Smoothing of Digital Images Libraries in CRAN biOps Image processing and analysis dcemri A Package for Medical Image Analysis dpmixsim Dirichlet Process Mixture model simulation for clustering & image segmentation edci Edge Detection and Clustering in Images epsi Edge Preserving Smoothing for Images FITSio FITS (Flexible Image Transport System) utilities PET Simulation and Reconstruction of PET Images R4dfp 4dfp MRI Image Read & Write Routines rimage Image Processing Module for R RImageJ R bindings for ImageJ ripa R Image Processing & Analysis tractor.base A package for reading, manipulating & visualising magnetic resonance images adimpro Adaptive Smoothing of Digital Images package:RImageJ • Authors: Romain Francois & Philippe Grosjean • Bindings between R and ImageJ • Open source • Java • Image analysis software http://rsbweb.nih.gov/ij/ Subjectivity vs. Objectivity • Hypothesis: blue blobs are always larger than yellow blobs Subjectivity • Hypothesis: blue blobs are always larger than yellow blobs Manual measurements Subjectivity • Hypothesis: blue blobs are always larger than yellow blobs It’s easy to accept manual measurements when they make sense, but it’s tempting to repeat them if they seem wrong Subjectivity • Hypothesis: blue blobs are always larger than yellow blobs Subjective observer accepts expected hypothesis Objectivity • Hypothesis: blue blobs are always larger than yellow blobs Automatically threshold Objectivity • Hypothesis: blue blobs are always larger than yellow blobs Objective observer automates analysis and rejects hypothesis Automate Procedures • Identify objects without making subjective decisions Run ImageJ from R • Open connection to an image • Use IJ$run() to access macros • Great potential for automating image processing from R Run ImageJ from R • However, some key macros not yet implemented (e.g. setAutoThreshold, imageCalculator) package:rimage • Author: Nikon • Reads jpegs into RGB arrays • Plot function defined for objects of class "imagematrix" Analyze information • Plots and statistical summaries of particles from image Single image Multiple images Conclusions • Images available? • Ensure quality/validate method • Choose useful measures • Use analysis to make predictions Acknowledgements • Mango Solutions www.mango-solutions.com • L. R. Contreras-Rojas, R. H. Guy http://www.bath.ac.uk/pharmacy/staff/rhg.html • NAPOLEON http://www.ehu.es/napoleon/