Initial Experience(s) Developing S4 Classes for Medical Imaging Data Brandon Whitcher, PhD GlaxoSmithKline Clinical Imaging Centre.

Slides:



Advertisements
Similar presentations
Symbol Table.
Advertisements

Object Oriented Programming
Concepts of SPM data analysis Marieke Schölvinck.
AP Computer Science A – Healdsburg High School 1 Unit 3 - Classes and Objects - Example.
Programming Paradigms and languages
50.530: Software Engineering Sun Jun SUTD. Week 10: Invariant Generation.
Chair of Software Engineering From Program slicing to Abstract Interpretation Dr. Manuel Oriol.
NIfTI-1 File Format Summary and Rationale RW Cox SSCC/DIRP/NIMH/NIH/DHHS/USA/EARTH with essential input from John Ashburner, Steve Smith, and Mark Jenkinson.
Pickatlas Data Interoperability Joseph Maldjian, MD.
Inheritance Definition Relationships Member Access Control Data Encapsulation Overloading vs. Overriding Constructors & Destructors.
FMRI: Biological Basis and Experiment Design Lecture 19: Data formats and data path DICOM DICOM servers Conversion between formats Slice-time correction.
Encapsulation by Subprograms and Type Definitions
Intelligent User Interfaces Research Group Directed by: Frank Shipman.
Lecture 7 C Pointers Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
E GOV Universal Access Ahmed Gomaa CIMIC Rutgers University.
Image Metadata Summary of 4/18/99 NISO/DLF Image Metadata Meeting ( Howard Besser UCLA School of Education & Information.
Principle of Functional Verification Chapter 1~3 Presenter : Fu-Ching Yang.
Wireless User Interface for Variable Frequency Drives Team 168 Alex Shuster (EE) Michael Kloter (EE) Christopher Perugini (EE) Kevin Wei (EngPhys - EE)
CSC 386 – Computer Security Scott Heggen. Agenda Introduction to Software Security.
Orbiter * IM512P/E Upgrade.  DOT Terminal Removed.  ALL DOT BIN Boards Removed.  All DOT Terminal Tasks now done in the IM512P/E.  Detector Energy.
Homework for October 2011 Nikolay Kostov Telerik Corporation
© GCSE Computing Candidates should be able to:  explain the representation of an image as a series of pixels represented in binary  explain the need.
OOD Case Study (For parallel treatment, see Chapter 2 of the text)
Shawlands Academy Higher Computing Data Representation.
Final Year Project Interim Presentation Software Visualisation and Comparison Tool Presented By : Shane Lillis, , 4th Year Computer Engineering.
An Introduction to MINC John G. Sled. What is MINC? A medical image file format based on NetCDF A core set tools and libraries for image processing A.
Keith Worsley Department of Mathematics and Statistics, and McConnell Brain Imaging Centre, Montreal Neurological Institute, McGill University Correlation.
Tot 15 LTPDA Graphic User Interface summary and status N. Tateo 26/06/2007.
PVEOut: Implementation of pvelab a framework for correcting PET and SPECT data for Partial Volume Effects PVEOut Satellite meeting Budapest, June 11 th.
23-Oct-15 Abstract Data Types. 2 Data types A data type is characterized by: a set of values a data representation, which is common to all these values,
1 Intro to Java Week 12 (Slides courtesy of Charatan & Kans, chapter 8)
Composition of UML Described Refactoring Rules Presented by Chin-Yi Tsai.
Functions, Procedures, and Abstraction Dr. José M. Reyes Álamo.
1 Intro to Data Structures and ADTs Chapter 2. 2 Goal of Data Structures Organize data Facilitate efficient … –storage –retrieval –manipulation Select.
Diffusion Tensor Imaging: The Nitty Gritty Brought to you by: Meenal and Erica November 2, 2010.
Of 50 E GOV Universal Access Ahmed Gomaa CIMIC Rutgers University.
Recovery-Oriented Computing Discovering Correctness Constraints for Self-Management of System Configuration Emre Kıcıman and Yi-Min Wang
Orbiter IM512PE Upgrade.  DOT Terminal Removed.  ALL DOT BIN Boards Removed.  All DOT Terminal Tasks now done in the IM512PE.  Detector Energy & Linearity.
**please note** Many slides in part 1 are corrupt and have lost images and/or text. Part 2 is fine. Unfortunately, the original is not available, so please.
King Fahd University of Petroleum and Minerals King Fahd University of Petroleum and Minerals Computer Engineering Department Computer Engineering Department.
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
Surgical Planning Laboratory -1- Brigham and Women’s Hospital Converting DTI data into Nrrd file format Sonia Pujol, Ph.D. Gordon.
Object Oriented Programming
FBIRN Use Case: Data Storage and Retrieval. User Query Results with standard descriptions in HIDB Results Images in SRB FIPS Result s FMRI Images Automated.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
National Diploma Unit 4 Introduction to Software Development Input and output processing.
Standard Response Evaluation Criteria in Solid Tumors (RECIST) using 3D Slicer Slicer3 Training Compendium Image here. Jeffrey Yap, PhD Wendy Plesniak,
Design Patterns Creational Patterns. Abstract the instantiation process Help make the system independent of how its objects are created, composed and.
MfD Co-registration and Normalisation in SPM
CSC 243 – Java Programming, Spring, 2014 Week 4, Interfaces, Derived Classes, and Abstract Classes.
CHAPTER 1 COMPUTER SCIENCE II. HISTORY OF COMPUTERS (1.1) Eniac- one of the worlds first computers Used more electricity than an entire city block of.
CSC 243 – Java Programming, Fall, 2008 Tuesday, September 30, end of week 5, Interfaces, Derived Classes, and Abstract Classes.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Introduction to the SPSS Interface
“<Fill in your definition here.>”
Computer Science II Chapter 1.
JAVA MULTIPLE CHOICE QUESTION.
Pipelines, Data Transfer, and Reconstructions
Andy Wang Object Oriented Programming in C++ COP 3330
CS 326 Programming Languages, Concepts and Implementation
Object-Orientated Programming
The Object-Oriented Thought Process Chapter 08
NWSI Neuroimaging Web Services Interface
Functions, Procedures, and Abstraction
CS2013 Lecture 7 John Hurley Cal State LA.
Introduction to the SPSS Interface
Functions, Procedures, and Abstraction
Image Metadata Summary of 4/18/99 NISO/DLF Image Metadata Meeting
Best Practices in Higher Education Student Data Warehousing Forum
Presentation transcript:

Initial Experience(s) Developing S4 Classes for Medical Imaging Data Brandon Whitcher, PhD GlaxoSmithKline Clinical Imaging Centre

2 Acknowledgements S4 Classes and MethodsS4 Classes and Methods –Slides by F. Leisch and P. Murrell –Software for Data Analysis by J. Chambers –R Programming for Bioinformatics by R. Gentlemen –R packages nlmenlme kernlabkernlab EBImageEBImage

3 OOP and Classes in R One identifies real objects, and the operations on them, that are interesting.One identifies real objects, and the operations on them, that are interesting. –These operations can be systematically implemented. A basic principle (hope) is that by faithfully representing the objects we get easier-to-implement functions.A basic principle (hope) is that by faithfully representing the objects we get easier-to-implement functions. A class is an abstract definition of a concrete real-world object.A class is an abstract definition of a concrete real-world object. A class system is a software infrastructure that is designed to help construct classes and to provide programmatic support for dealing with classes.A class system is a software infrastructure that is designed to help construct classes and to provide programmatic support for dealing with classes.

4 Why (S4) Classes for Medical Imaging Data? Context of imaging dataContext of imaging data Interface with data standards and third-party softwareInterface with data standards and third-party software Numerous processing steps involvedNumerous processing steps involved –Multiple information sources Audit trail (internal and external agencies)Audit trail (internal and external agencies) Too easy to make mistakes!Too easy to make mistakes!

5 Data Analysis Pipeline Pre-processing Mathematical Modelling Statistical Analysis Data Results Motion correction Warping Co-registration Model building Parameter estimation Test statistics p-values Multiple comparisons

6 Medical Imaging Data Slice Thickness; e.g. 5mm Spatial Resolution Size = X × Y; e.g. 256×256 X Y e.g. 0.4mm Chosen parameters depend on many factors: application, scanner, local practice, radiologist preferences, etc. X Z

7 Composition of Structural Data convert DICOM X Y Z NIfTI 3D

8 Composition of Dynamic Data X Y Z t = 1 X Y Z t = T NIfTI 4D

9 The nifti Class Inherits from class arrayInherits from class array Contains 44 “slots” (not counting.Data )Contains 44 “slots” (not counting.Data ) –both numeric and character strings [348 bytes] Also created function nifti() for user-defined slots.Also created function nifti() for user-defined slots. Similar class has been defined for ANALYZE data.Similar class has been defined for ANALYZE data. setClass(“nifti”, representation(“sizeof_hdr”=“numeric”, “data_type”=“character”,...), prototype(“sizeof_hdr”=348, “data_type”=“”,...), contains=“array”)

10 Method “show” for nifti Class setMethod(“show”, “nifti”, function(object) { cat(“NIfTI-1 file format”, fill=TRUE) cat(...) }) > ffd NIfTI-1 format Type : nifti Data Type : 4 (INT16) Bits per Pixel : 16 Slice Code : 0 (Unknown) Intent Code : 0 (None) Qform Code : 1 (Scanner_Anat) Sform Code : 0 (Unknown) Dimension : 64 x 64 x 21 x 180 Pixel Dimension : 4 x 4 x 6 x 3 Voxel Units : mm Time Units : sec

11 Validity Checking for nifti Class setValidity(“nifti”, function(object) { retval <- NULL... if != 348) retval <- c(retval, “sizeof_hdr != 348”) if %in% c(2^(1:11),768,1280,1536,1792)) retval <- c(retval, “datatype not recognized”)... if == retval <- c(retval, “dim/img mismatch”)... if (is.null(retval)) return(TRUE) else return(retval) })

12 Manipulation of Slots The nifti header allows limited text informationThe nifti header allows limited text information –descrip (80 characters) and aux_file (24 characters) –Replacement functions Acessor functions > aux.file(mniLR) [1] "none " > descrip(mniLR) [1] "FSL3.2beta" Slots > [1] "none " > [1] "FSL3.2beta" setMethod(“descrip”, “nifti”, function(object) { }) setGeneric(“descrip<-”, function(x, value) { standardGeneric(“descrip<-”) }) setReplaceMethod(“descrip”, “nifti”, function(x, value) { <- value x })

13 Additional Methods readNIfTI() and writeNIfTI()readNIfTI() and writeNIfTI() –IO functions for NIfTI data (100% R ) –Affine transformations image()image() –Forces S3 method into proper generic method –Equivalent to a “lightbox” representation overlay()overlay() –Essentially, the image function for two input arrays orthographic()orthographic() –2×2 matrix of plots: coronal, sagittal, axial –Utilizes “pixel dimension” slot

14 ffd <- readNIfTI(“filtered_func_data.nii.gz”) image(ffd, zlim=range(ffd)) # Figure 1 zstat1 <- readNIfti(“zstat1.nii.gz”) overlay(ffd, ifelse(abs(zstat1) > 5, zstat1, NA), zlim.x=range(ffd)) # Figure 2

15 mni <- readNIfTI(“avg152T1_LT_nifti.nii.gz”) orthographic(mni, zlim=range(mni)) > mniLR NIfTI-1 format Type : nifti Data Type : 2 (UINT8) Bits per Pixel : 8 Slice Code : 0 (Unknown) Intent Code : 0 (None) Qform Code : 0 (Unknown) Sform Code : 4 (MNI_152) Dimension : 91 x 109 x 91 Pixel Dimension : 2 x 2 x 2 Voxel Units : mm Time Units : sec

16 Coercion and Extensions CoercionCoercion –Implicit since nifti class is built on the array class. –But... it will fail validObject(). Allow extensions via the NIfTI-1.1 mechanism.Allow extensions via the NIfTI-1.1 mechanism. –Define new class “niftiExtension” –Implement full audit trail XML document – library(“XML”)XML document – library(“XML”) > A <- array(1:8^3, rep(8,3)) > B <- as(A, “nifti”) > dim(B) [1] > [1]

17 Conclusions S4 classes are powerfulS4 classes are powerful –Robust framework –Generics and methods –Validity checking –Inheritance... and difficult... and difficult –Documentation (lack thereof) –Examples (lack thereof) –Slower than S3 (?)

18 Todo List Integrate S4 class into image analysis functions.Integrate S4 class into image analysis functions. –Modification of.Data causes modification of slot(s) Use cniftilib to be 100% NIfTI compliantUse cniftilib to be 100% NIfTI compliant –Rniftilib by Oliver Granert ()

19 Extra Slides

20 Data Formats Digital Imaging and Communications in Medicine (DICOM); 1992.Digital Imaging and Communications in Medicine (DICOM); –Binary file with a dynamic header description. ANALYZE™ 7.5 File Format; 199?.ANALYZE™ 7.5 File Format; 199?. –An image (.img) file –A header (.hdr) file [348 bytes] Neuroimaging Informatics Technology Initiative (NIfTI); 2004.Neuroimaging Informatics Technology Initiative (NIfTI); –Adapted from ANALYZE 7.5 –Dual file (.hdr &.img) –Single file (.nii) [348+ bytes]