1 ITK Lecture 6 - The Pipeline Methods in Image Analysis CMU Robotics Institute 16-725 U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image Analysis.

Slides:



Advertisements
Similar presentations
ITK Architecture Kitware Inc.. ITK Basics C++ Generic Programming Data Pipeline Multi-threading Streaming Exceptions Events / Observers Tcl, Python and.
Advertisements

Intro to Computer Org. Pipelining, Part 2 – Data hazards + Stalls.
The Assembly Language Level
AU/MITM/1.6 By Mohammed A. Saleh 1. Arguments passed by reference  Until now, in all the functions we have seen, the arguments passed to the functions.
1 ITK Lecture 10 Review & Toolbox Part II Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Damion.
Methods in Image Analysis 2004, Damion Shelton 1 ITK Lecture 4 Images in ITK Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering.
Week 11 - Friday.  What did we talk about last time?  Object methods  Accessors  Mutators  Constructors  Defining classes.
Lecture 18 Templates, Part II. From Last Time: What is a Template? This is the “official” specification for a template. It says that to define a template.
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.
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.
1 Introduction to Computability Theory Lecture15: Reductions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
CS 106 Introduction to Computer Science I 03 / 21 / 2008 Instructor: Michael Eckmann.
Chapter 5: Loops and Files.
Pipelining. Overview Pipelining is widely used in modern processors. Pipelining improves system performance in terms of throughput. Pipelined organization.
1 ITK Lecture 2 A brief C++ review Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image.
Other Features Index and table of contents Macros and VBA.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
13&14-2 Know the forms of loop statements in C (while,do/while,for). Understanding how data conversion occurs. Read/Write data in files using Unix redirection.
11 A First Game Program Session Session Overview  Begin the creation of an arcade game  Learn software design techniques that apply to any form.
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
ITK Lecture 13: Registration
ITK Input/Output Kitware Inc.. Overview IO Factory Mechanism Image File IO Transform File IO SpatialObject File IO Logger.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Introduction to Concurrency.
1 ITK Lecture 8 - Neighborhoods Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image.
Computers and Scientific Thinking David Reed, Creighton University Functions and Libraries 1.
CS107 References and Arrays By Chris Pable Spring 2009.
Methods in Image Analysis 2004, Damion Shelton 1 ITK Lecture 9 - Toolbox Part I Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering.
ADTs and C++ Classes Classes and Members Constructors The header file and the implementation file Classes and Parameters Operator Overloading.
1 ITK Lecture 9 - Toolbox Part I Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image.
Pipes & Filters Architecture Pattern Source: Pattern-Oriented Software Architecture, Vol. 1, Buschmann, et al.
The content of these slides by John Galeotti, © Carnegie Mellon University (CMU), was made possible in part by NIH NLM contract# HHSN P,
Computer Engineering Rabie A. Ramadan Lecture 5.
COMPUTER PROGRAMMING. Functions’ review What is a function? A function is a group of statements that is executed when it is called from some point of.
Identifiers Identifiers in Java are composed of a series of letters and digits where the first character must be a letter. –Identifiers should help to.
Basic & Advanced Reporting in TIMSNT ** Part Three **
Recap Saving Plots Summary of Chapter 5 Introduction of Chapter 6.
CSI 3125, Preliminaries, page 1 Compiling the Program.
Loops and Files. 5.1 The Increment and Decrement Operators.
Methods Methods are how we implement actions – actions that objects can do, or actions that can be done to objects. In Alice, we have methods such as move,
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
IST 220 – Intro to Databases Lecture 2 Touring Microsoft Access.
1 ITK Lecture 5 Intro to Iterators Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image.
Lecture 2 Functions. Functions in C++ long factorial(int n) The return type is long. That means the function will return a long integer to the calling.
Multiple File Compilation and linking By Bhumik Sapara.
Numerical formats What’s the main idea? Want to represent numbers (eg: 45, -12, ) using only bits. We’ve already seen (or you can read in the book)
Functions Skill Area 314 Part B. Lecture Overview Functions Function Prototypes Function Definitions Local Variables Global Variables Default Parameters.
Software testing techniques Software testing techniques REGRESSION TESTING Presentation on the seminar Kaunas University of Technology.
Aggregator Stage : Definition : Aggregator classifies data rows from a single input link into groups and calculates totals or other aggregate functions.
REGRESSION TESTING Audrius Čėsna IFM-0/2. Regression testing is any type of software testing that seeks to uncover new errors, or regressions, in existing.
Report on the FCT MDC Stuart Anderson, Kent Blackburn, Philip Charlton, Jeffrey Edlund, Rick Jenet, Albert Lazzarini, Tom Prince, Massimo Tinto, Linqing.
ITK 9.3. Level Set Segmentation Shape Detection Segmentation
Copyright © 2002 Pearson Education, Inc. Slide 1.
Copyright © 2002 Pearson Education, Inc. Slide 1.
How to use a Pixel Shader CMT3317. Pixel shaders There is NO requirement to use a pixel shader for the coursework though you can if you want to You should.
Java Unit 11: Inheritance I
User-Written Functions
IST 220 – Intro to Databases
CS 1110 Introduction to Programming Spring 2017
SOFTWARE DESIGN AND ARCHITECTURE
Lecture 13 & 14.
Lecture 5A File processing Richard Gesick.
ITK Architecture Kitware Inc..
File I/O in C++ I.
ECE 352 Digital System Fundamentals
File Input and Output.
File I/O in C++ I.
四時讀書樂 (春) ~ 翁森 山光照檻水繞廊,舞雩歸詠春風香。 好鳥枝頭亦朋友,落花水面皆文章。 蹉跎莫遣韶光老,人生唯有讀書好。
Presentation transcript:

1 ITK Lecture 6 - The Pipeline Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Methods in Image Analysis CMU Robotics Institute U. Pitt Bioengineering 2630 Spring Term, 2006 Damion Shelton

2 What’s a pipeline?  You may recall that ITK is organized around data objects and process objects  You should now be somewhat familiar with the primary data object, itk::Image  Today we’ll talk about how to do cool things to images, using process objects  You may recall that ITK is organized around data objects and process objects  You should now be somewhat familiar with the primary data object, itk::Image  Today we’ll talk about how to do cool things to images, using process objects

3 The pipeline idea SourceImageFilter ImageFilterImage Start here End here The pipeline consists of data objects, and things that create data objects (i.e. process objects).

4 Image sources itk::ImageSource The base class for all process objects that produce images without an input image SourceImageFilter ImageFilterImage Start here End here

5 Image to image filters itk::ImageToImageFilter The base class for all process objects that produce images when provided with an image as input. SourceImageFilter ImageFilterImage Start here End here

6 Input and output  ImageSource’s do not require input, so they have only a GetOutput() function  ImageToImageFilter’s have both SetInput() and GetOutput() functions  ImageSource’s do not require input, so they have only a GetOutput() function  ImageToImageFilter’s have both SetInput() and GetOutput() functions

7 Ignoring intermediate images SourceImageFilter ImageFilterImage Start here End here SourceFilterImageFilter Start here End here =

8 How this looks in code SrcType::Pointer src = SrcType::New(); FilAType::Pointer filterA = FilAType::New(); FilBType::Pointer filterB = FilBType::New(); src->SetupTheSource(); filterA->SetInput( src->GetOutput() ); filterB->SetInput( filterA->GetOutput() ); ImageType::Pointer im = filterB->GetOutput(); SrcType::Pointer src = SrcType::New(); FilAType::Pointer filterA = FilAType::New(); FilBType::Pointer filterB = FilBType::New(); src->SetupTheSource(); filterA->SetInput( src->GetOutput() ); filterB->SetInput( filterA->GetOutput() ); ImageType::Pointer im = filterB->GetOutput();

9 When execution occurs  The previous page of code only sets up the pipeline - i.e., what connects to what  This does not cause the pipeline to execute  In order to “run” the pipeline, you must call Update() on the last filter in the pipeline  The previous page of code only sets up the pipeline - i.e., what connects to what  This does not cause the pipeline to execute  In order to “run” the pipeline, you must call Update() on the last filter in the pipeline

10 Propagation of Update()  When Update() is called on a filter, the update propagates back “up” the pipeline until it reaches a process object that does not need to be updated, or the start of the pipeline

11 When are process objects updated?  If the input to the process object has changed  If the process object itself has been modified - e.g., I change the radius of a Gaussian blur filter  If the input to the process object has changed  If the process object itself has been modified - e.g., I change the radius of a Gaussian blur filter How does it know?

12 Detecting process object modification The easy way is to use itkSetMacro(MemberName, type); which produces the function void SetMemberName(type); that calls Modified() for you when a new value is set in the class. For example: itkSetMacro(DistanceMin, double); sets member variable m_DistanceMin The easy way is to use itkSetMacro(MemberName, type); which produces the function void SetMemberName(type); that calls Modified() for you when a new value is set in the class. For example: itkSetMacro(DistanceMin, double); sets member variable m_DistanceMin

13 Process object modification, cont.  The other way is to call Modified() from within a process object function when you know something has changed this->Modified();  You can call Modified() from outside the class as well, to force an update  Using the macros is a better idea though...  The other way is to call Modified() from within a process object function when you know something has changed this->Modified();  You can call Modified() from outside the class as well, to force an update  Using the macros is a better idea though...

14 Running the pipeline - Step 1 Not sureModified SourceFilterImageFilter Start here End here Updated Update() Modified?

15 Running the pipeline - Step 2 Not sureModified SourceFilterImageFilter Start here End here Updated

16 Not sure Updated Modified SourceFilterImageFilter Start here End here Running the pipeline - Step 3

17 Not sure Updated Modified SourceFilterImageFilter Start here End here Running the pipeline - Step 4

18 Not sure Updated Modified SourceFilterImageFilter Start here End here Change a filter parameter here Call Update() here Modifying the pipeline - Step 1

19 Not sure Updated Modified SourceFilterImageFilter Start here End here We detect that the input is modified This executes Modifying the pipeline - Step 2

20 Not sure Updated Modified SourceFilterImageFilter Start here End here This executes Modifying the pipeline - Step 3

21 Thoughts on pipeline modification  Note that in the previous example the source never re-executed; it had no input and it was never modified, so the output cannot have changed  This is good! We can change things at the end of the pipeline without wasting time recomputing things at the beginning  Note that in the previous example the source never re-executed; it had no input and it was never modified, so the output cannot have changed  This is good! We can change things at the end of the pipeline without wasting time recomputing things at the beginning

22 It’s easy in practice 1. Build a pipeline 2. Call Update() on the last filter - get the output 3. Tweak some of the filters 4. Call Update() on the last filter - get the output 5....ad nauseam 1. Build a pipeline 2. Call Update() on the last filter - get the output 3. Tweak some of the filters 4. Call Update() on the last filter - get the output 5....ad nauseam

23 Reading & writing  You will often begin and end pipelines with readers and writers  Fortunately, ITK knows how to read a wide variety of image types!  You will often begin and end pipelines with readers and writers  Fortunately, ITK knows how to read a wide variety of image types!

24 Reading and writing images  Use itk::ImageFileReader to read images  Use itk::ImageFileWriter to write images  Both classes have a SetImageIO(ImageIOBase*) function used to specify a particular type of image to read or write  Use itk::ImageFileReader to read images  Use itk::ImageFileWriter to write images  Both classes have a SetImageIO(ImageIOBase*) function used to specify a particular type of image to read or write

25 Reading an image (4.1.2)  Create a reader  Create an instance of an ImageIOBase derived class (e.g. PNGImageIO)  Pass the IO object to the reader  Set the file name of the reader  Update the reader  Create a reader  Create an instance of an ImageIOBase derived class (e.g. PNGImageIO)  Pass the IO object to the reader  Set the file name of the reader  Update the reader

26 Reader notes  The ImageType template parameter is the type of image you want to convert the stored image to, not necessarily the type of image stored in the file  ITK assumes a valid conversion exists between the stored pixel type and the target pixel type  The ImageType template parameter is the type of image you want to convert the stored image to, not necessarily the type of image stored in the file  ITK assumes a valid conversion exists between the stored pixel type and the target pixel type

27 Writing an image  Almost identical to the reader case, but you use an ImageFileWriter instead of a reader  If you’ve already created an IO object during the read stage, you can recycle it for use with the writer  Almost identical to the reader case, but you use an ImageFileWriter instead of a reader  If you’ve already created an IO object during the read stage, you can recycle it for use with the writer

28 More read/write notes  ITK actually has several different ways of reading files - what I’ve presented is the simplest conceptually  Other methods exist to let you read files without knowing their format  ITK actually has several different ways of reading files - what I’ve presented is the simplest conceptually  Other methods exist to let you read files without knowing their format