1 ITK Lecture 10 Review & Toolbox Part II Methods in Image Analysis CMU Robotics Institute 16-725 U. Pitt Bioengineering 2630 Spring Term, 2006 Damion.

Slides:



Advertisements
Similar presentations
CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 4 – Digital Image Representation Klara Nahrstedt Spring 2009.
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
1 Lecture 20 Sequential Circuits: Latches. 2 Overview °Circuits require memory to store intermediate data °Sequential circuits use a periodic signal to.
This work by John Galeotti and Damion Shelton, © , was made possible in part by NIH NLM contract# HHSN P, and is licensed under a Creative.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
Computer Graphics Viewing.
1 ITK Lecture 7 - Writing Filters, Part 1 Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods.
Methods in Image Analysis 2004, Damion Shelton 1 ITK Lecture 6 - The Pipeline Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering.
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
HCI 530 : Seminar (HCI) Damian Schofield.
Programming for Image Processing/Analysis and Visualization using The Visualization Toolkit Xenios Papademetris BML 325,
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
Part I: Basics of Computer Graphics Rendering Polygonal Objects (Read Chapter 1 of Advanced Animation and Rendering Techniques) Chapter
ME 4135 Robotics & Control Slide Set 3 – Review of Matrix Methods Applicable to Robot Control.
This work by John Galeotti and Damion Shelton, © , was made possible in part by NIH NLM contract# HHSN P, and is licensed under a Creative.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Hidden Surface Removal
Computer Graphics Mirror and Shadows
Objectives Review some advanced topics, including Review some advanced topics, including Chapter 8: Implementation Chapter 8: Implementation Chapter 9:
COMP 175: Computer Graphics March 24, 2015
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
Spatial Filtering: Basics
Chapter 3 PART 2 - SPREADSHEET CMPF 112 : COMPUTING SKILLS CALC FOR LINUX.
IT253: Computer Organization
02/26/02 (c) 2002 University of Wisconsin, CS 559 Last Time Canonical view pipeline Orthographic projection –There was an error in the matrix for taking.
Computer Graphics Texture Mapping
This work by John Galeotti and Damion Shelton was made possible in part by NIH NLM contract# HHSN P, and is licensed under a Creative Commons.
CS654: Digital Image Analysis Lecture 3: Data Structure for Image Analysis.
Week 2 - Wednesday CS361.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
Lecture 7 – Data Reorganization Pattern Data Reorganization Pattern Parallel Computing CIS 410/510 Department of Computer and Information Science.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
Emerging Technologies for Games Alpha Sorting and “Soft” Particles CO3303 Week 15.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications
1 ITK Lecture 8 - Neighborhoods Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
Methods in Image Analysis 2004, Damion Shelton 1 ITK Lecture 9 - Toolbox Part I Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering.
More on Advanced Interfaces, Image Basics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, November 21, 2003.
1 ITK Lecture 9 - Toolbox Part I Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
1 A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 4 JavaScript and.
Texture Mapping CAP4730: Computational Structures in Computer Graphics.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
1 ITK Lecture 6 - The Pipeline Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image Analysis.
1 ITK Lecture 5 Intro to Iterators Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image.
CS Spring 2010 CS 414 – Multimedia Systems Design Lecture 4 – Audio and Digital Image Representation Klara Nahrstedt Spring 2010.
CS 1114: Finding things Prof. Graeme Bailey (notes modified from Noah Snavely, Spring 2009)
Introduction to Parametric Curve and Surface Modeling.
Advanced Computer Systems
Visible Surface Detection
AP CSP: Cleaning Data & Creating Summary Tables
- Introduction - Graphics Pipeline
Geometric Transformations
VTK: The Visualization Toolkit
Visualization Shading
Frame Update, Level Representation & Graphics
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Convolutional Networks
Lecture 19 Write Your Own ITK Filters, Part2
Chapter V Vertex Processing
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
What's New in eCognition 9
Presentation transcript:

1 ITK Lecture 10 Review & Toolbox Part II Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Damion Shelton

2 Some thoughts I’ve collected a bunch of stuff that is either: –Grandiose preaching from the pulpit –Useful filters/tips/tricks I’ve run across A lot of what I’ll be talking about I’ve mentioned in passing before; hopefully you have a different perspective after having written a filter

3 Generic programming revisited Generic programming may be loosely defined as “programming with concepts” (David Musser) What concepts have we looked at so far?

4 Concept of an image An image is rectilinear container in N-space which holds regular samples of some physical space Each of these regular samples is called a pixel

5 Concept of a pixel A pixel is a sample of data in N-space, and may be represented by a variety of data types depending on the modality used to acquire the data

6 Concept of an iterator An iterator is a way to move over an image; it provides method that mimics “sequential” access regardless of the actual access method or dimensionality

7 Concept of a pipeline There are two main types of objects in the world, data objects and process objects Typically, we feed a data object to a process object and get a new data object as a result A sequentially chain of process objects is called a pipeline

8 Writing generic code Successful generic programming means that you “ignore” concerns that would be specific to a particular image –pixel type (i.e. the actual data type) –dimensionality The first way you do this is with templating

9 Writing generic code, cont. But... templating alone doesn’t ensure that your code is generic Avoid loops that maneuver through dimensionality, instead, loop over an iterator Use data types (VNL vectors, etc.) to make math easier in N-d

10 Questions to ask yourself Am I making tradeoffs between: –Speed of coding and reusability? –Level of generality and execution speed? –Compactness and clarity? ITK seems to lean towards reusable, generic, and clear code; depending on your needs this may be a criticism or a point in favor of the toolkit

11 When generic programming fails As much as we’d like, not all algorithms extend to N-d or to all pixel types But... don’t assume that things won’t work in higher (or lower) dimensions I was surprised to discover that code I wrote to do medial axis analysis in 3D worked correctly on a 4D hypersphere

12 The “other” way of reading images You may recall that I mentioned there was another way of reading images, besides that presented in class This method relies on ITK’s “factory” architecture

13 Image reading: first technique We know what kind of image we have (from a dialog box, for instance) Create a reader that can read that type of image Read the image

14 Image reading: second technique We know what kinds of images we might have, but don’t assume that the user knows Register instances of all of reader types we might need The readers will let us know if they can read the file and will do so if possible

15 Reading images with the factory m_ImageReader = ImageFileReaderType::New(); itk::MetaImageIOFactory::RegisterOneFactory(); m_ImageReader->SetFileName(m_Filename ); m_ImageReader->Update(); Here I only register one factory, but there’s no reason I couldn’t have more

16 Factory advantages The factory model of image reading is a bit more flexible and requires less advance knowledge If you have a dialog box, you don’t have to parse the filename to decide what type of reader to create Less risk of being “wrong” about file types

17 Factory disadvantages I find it a bit harder to think of conceptually, and you often know what image formats you’re dealing with anyways

18 Gallery of useful ITK classes These are classes I have found that solve particularly common problems that arise in image processing Don’t re-invent the wheel! This list is not comprehensive (obviously) I leave specific documentation of these filters as an EFTR

19 Padding an image Problem: you need to add extra pixels outside of an image (e.g., prior to running a filter) Solution: PadImageFilter & its derived classes

20 Cropping an image Problem: trimming image data from the outside edges of an image (the inverse of padding) Solution: CropImageFilter

21 Rescaling image intensity Problem: you need to translate between two different pixel types, or need to shrink or expand the dynamic range of a particular pixel type Solution: RescaleIntensityImageFilter

22 Computing image derivatives Problem: you need to compute the derivative at each pixel in an image Solution: DerivativeImageFilter, which is a wrapper for the neighborhood tools discussed last week See also LaplacianImageFilter

23 Compute the mirror image Problem: you want to mirror an image about a particular axis or axes Solution: FlipImageFilter - you specify flipping on a per-axis basis

24 Rearrange the axes in an image Problem: the coordinate system of your image isn’t what you want; the x axis should be z, and so on Solution: PermuteAxesImageFilter - you specify which input axis maps to which output axis

25 Resampling an image Problem: you want to apply an arbitrary coordinate transformation to an image, with the output being a new image Solution: ResampleImageFilter - you control the transform and interpolation technique

26 Getting a lower dimension image Problem: you have read time-series volume data as a single 4D image, and want a 3D “slice” of this data (one frame in time), or want a 2D slice of a 3D image, etc. Solution: ExtractImageFilter - you specify the region to extract and the “index” within the parent image of the extraction region

27 An(other) introduction to VTK For the remainder of this class I’ll present a brief summary of how VTK works It’s useful to know what’s going on behind the scenes in myITKgui It’s very likely that some of you will want to use VTK in stand-alone mode without the FLTK wrapper

28 Rendering layout of VTK vtkRenderWindow defines the window that is displayed on your monitor vtkRenderers are attached to windows and are responsible for converting more abstract primitives (vtkActors) into displayed images

29 Actors in VTK The basic “thing” that can be displayed in VTK is an Actor Mappers convert raw data to Actors For example: –boundary points in ITK  VTK pointset  VTK point mask filter  VTK polygon data mapper  VTK actor

30 vtkRenderWindowInteractors Interactors are objects that work with RenderWindows to pass mouse and keyboard events back and forth One particularly useful interactor is vtkFlRenderWindowInteractor, which lets you use VTK windows with the FLTK window manager

31 Widgets Widgets are more complicated objects that combine some of the functionality of Interactors and Actors The ImagePlaneWidget is a mouse- controlled object that provides an arbitrary slice through a 3D volume

32 Program layout 1.Create a RenderWindow 2.Create a Renderer 3.Create a FlRenderWindowInteractor 4.Load an image 5.Create 3 image plane widgets, attach them to the interactor 6.Enter a message loop to run the program

33 Adding additional “stuff” It’s easier than you might think to render additional objects along with the image plane widgets (boundary points for instance) Starting with some sort of object in ITK, you would do the following...

34 Arbitrary object visualization 1.Figure out what type of primitive you have (points/lines/etc.) 2.Create VTK data representing your primitives 3.Convert this to poly data 4.Map this to an actor

35 Data representation in VTK For geometric data, you may be interested in the following classes: –vtkPoints stores a list of 3D points –vtkUnstructuredGrid stores a collection of arbitrary cells, where a cell is a primitive such as a vertex or line (vtkLine)

36 Data representation cont. This may seem a bit convoluted, but in practice it’s pretty simple once you get the hang of it VTK has a pipeline, similar to that of ITK, so changing the data/mapper/etc. will affect downstream filters but not upstream ones

37 Cool side effects My “favorite” 1 added bonus of using VTK is the ability to export scenes to files Since data and rendering are abstracted away from each other, it’s pretty easy to, for example, dump your entire rendering setup to a Pixar Renderman format file 1 Favorite du jour