1 / 49

Welcome to the Insight Toolkit! ITK Lecture 2 - Getting Started

Welcome to the Insight Toolkit! ITK Lecture 2 - Getting Started. Methods in Image Analysis CMU Robotics Institute 16-725 U. Pitt Bioengineering 2630 Spring Term, 2004. Goals for this week. Compile, compile, compile Learn how to use CMake Build ITK Compile several programs that use ITK

essien
Download Presentation

Welcome to the Insight Toolkit! ITK Lecture 2 - Getting Started

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Welcome to the Insight Toolkit!ITK Lecture 2 - Getting Started Methods in Image Analysis CMU Robotics Institute 16-725 U. Pitt Bioengineering 2630 Spring Term, 2004 Methods in Image Analysis 2004, Damion Shelton

  2. Goals for this week • Compile, compile, compile • Learn how to use CMake • Build ITK • Compile several programs that use ITK • Find documentation online • Learn the quirks (if any) of the system you choose to use Methods in Image Analysis 2004, Damion Shelton

  3. Online course access • Distribution of lectures/homeworks/etc. will be handled via our lab web site: http://www.vialab.org/methods_course/index.html Methods in Image Analysis 2004, Damion Shelton

  4. Getting help • Email the TA - Aaron Cois • cacst11@pitt.edu • Email me - Damion Shelton • beowulf+teaching@cs.cmu.edu • PLEASE remember the +teaching!! • Join the insight-users mailing list; instructions are at http://www.itk.org Methods in Image Analysis 2004, Damion Shelton

  5. Getting help, cont. • Get help at Pitt • Aaron’s office is BEH 761 • Office phone 412-624-9931 • Get help at CMU • Damion’s office is NSH, A408-o (in the cube farm) • Office phone 412-268-3866 • Email is usually the easiest contact method Methods in Image Analysis 2004, Damion Shelton

  6. Assignments • Collaboration is encouraged; unless told otherwise, feel free to discuss assignments with other students • But… please submit your own code - don’t copy and paste stuff from friends • More so than other classes, you will be learning techniques that translate directly to the real world - don’t cheat yourself Methods in Image Analysis 2004, Damion Shelton

  7. Grading of assignments • Grading criteria: • Does it accomplish the specified task? • Is it well commented? Follow the “6 month rule” - if you leave for 6 months, you should be able to pick up where you left off. • Many/most assignments will be pass-fail, with an opportunity to fix problems before final judgement is passed Methods in Image Analysis 2004, Damion Shelton

  8. Assignments, cont. • Please interpret due dates as absolute, unless told otherwise • Really • Aaron and I are happy to spend time helping you debug code, but not at 11 pm the day before the assignment is due Methods in Image Analysis 2004, Damion Shelton

  9. Computer requirements • Windows, Linux, and Mac OS 10.2+ work great, other platforms will work too • Your own computer is preferable, but cluster machines will work • Please be aware that ITK can consume a lot of disk space during the build process • There is no reason to use one of the platforms over another, pick your favorite Methods in Image Analysis 2004, Damion Shelton

  10. We can help you with • Windows & Linux: Aaron or Damion • MacOS: Damion • Sun, SGI, Cygwin: You’re on your own • If you’re going to have compiler problems, they’ll show up early in the course, so don’t procrastinate the first assignment Methods in Image Analysis 2004, Damion Shelton

  11. What is ITK? • To clarify, ITK is a toolkit • It doesn’t “do” anything • You can’t “run” it • There isn’t an itk.exe file • Typically, you use ITK in conjunction with other toolkits to handle visualization and GUI interaction Methods in Image Analysis 2004, Damion Shelton

  12. So, what’s it good for? • ITK code is easy to add to existing C++ code • It provides a variety of flexible data containers, and ways of processing / analyzing them • You can do a lot in only a few lines of code • Once you get used to it, it’s easy to use (gasp!) Methods in Image Analysis 2004, Damion Shelton

  13. What we assume you can do • Understand C++ syntax • Classes • Basic inheritance • Standard flow control such as for, do, calling functions, etc. • Pointers, dereferencing, passing by reference • Work comfortably in the operating system of your choice, using the compiler of your choice Methods in Image Analysis 2004, Damion Shelton

  14. What you might be able to do • Generic programming • Templates & templated classes • Partial specialization • The typedef & typename keywords • Revision control using CVS • Collaborative programming Methods in Image Analysis 2004, Damion Shelton

  15. You probably have not… • Used cross-platform make software (Jam, for example) • Written C++ code that builds on multiple platforms • Designed software using a data-flow architecture, worried about smart pointers, etc. Methods in Image Analysis 2004, Damion Shelton

  16. Step 0 - Don’t panic! • There is substantial documentation on everything I’m going to present here, and vastly more about things that we will never cover in this course • http://www.itk.org/HTML/Documentation.htm • You have a copy of the ITK Software Guide on the CD Aaron made for you Methods in Image Analysis 2004, Damion Shelton

  17. Please DON’T wear yourself trying to write down all of the content of the following slides; they’ll be on the course web page • DO interrupt me and ask questions if something isn’t clear Methods in Image Analysis 2004, Damion Shelton

  18. Step 1 • Get all of the code • Fortunately, Aaron made CD’s for you • If you’re working on some particularly esoteric platform, it’s possible that you’re missing a binary version of CMake for your machine Methods in Image Analysis 2004, Damion Shelton

  19. C++ Compiler gcc 2.95 – 3.2 Visual C++ 6.0 Visual .NET Intel 5.0 IRIX CC Borland 5.0 Mac OSX - gcc CMake www.cmake.org What do I need ? Methods in Image Analysis 2004, Damion Shelton

  20. Cross platform development • ITK builds on a large combination of operating systems and platforms • Each compiler has it’s own input format; makefiles, workspaces, etc. • Q: How can you possibly coordinate builds on different platforms? Methods in Image Analysis 2004, Damion Shelton

  21. The answer: CMake • Cross platform tool to manage the build process • Simplifies the build process • Auto-configuration • Easy access to external libraries • Used by several other open source projects www.cmake.org Methods in Image Analysis 2004, Damion Shelton

  22. How CMake runs • Write a CMakeLists.txt file describing your project in CMake’s language • Run CMake to generate an appropriate makefile/project/workspace for your compiler • Compile as you normally would Methods in Image Analysis 2004, Damion Shelton

  23. How CMake runs, cont. • This is not unlike the configure-make process you may be familiar with from various Unix systems • But… it works with many disparate compilers • CMakeLists.txt files are easy to perform revision control on Methods in Image Analysis 2004, Damion Shelton

  24. Binary Tree Out Source Build ITK ITKb Recommended ! Common Common Algorithms Algorithms BasicFilter BasicFilter Numerics Numerics In Source Build IO IO In source vs. out source builds Source Tree Methods in Image Analysis 2004, Damion Shelton

  25. Why use two trees? • Keeps your source and binary code separate • Minimizes the amount of damage you can do to your CVS tree • ITK is found in the /Insight folder • We suggest that you build it in the /InsightBin folder Methods in Image Analysis 2004, Damion Shelton

  26. Configure - Easy Start • Run CMake • Select the SOURCE directory • Select the BINARY directory Methods in Image Analysis 2004, Damion Shelton

  27. Configure - Easy Start, cont. Methods in Image Analysis 2004, Damion Shelton

  28. Configure - Easy Start, cont. • Disable BUILD_EXAMPLES • Disable BUILD_TESTING • Disable USE_FLTK • Disable USE_VTK • Disable ITK_WRAP_TCL Methods in Image Analysis 2004, Damion Shelton

  29. Configure - Easy Start, cont. • Ignore CMAKE_CXX_FLAGS • Ignore DART_ROOT • Ignore ITK_DATA_ROOT • Ignore VW_RAW_DATA_PATH Methods in Image Analysis 2004, Damion Shelton

  30. Configuring and Generating • Each time you change an option or options you may need to “configure” CMake again • If the generate option (“OK” under Windows) is not presented, you definitely need to hit configure again • If any of the options are highlighted in red, you need to reconfigure Methods in Image Analysis 2004, Damion Shelton

  31. Build ITK Methods in Image Analysis 2004, Damion Shelton

  32. Build ITK • Open ITK.dsw in the Binary Directory • Select ALL_BUILD project • Build it - it takes about 15 minutes on a P3-1000, but your mileage may vary Methods in Image Analysis 2004, Damion Shelton

  33. Verify the Build Libraries will be found in: ITK_BINARY / bin / { Debug, Release} Methods in Image Analysis 2004, Damion Shelton

  34. The following libraries should be there (possibly an out of date list) ITKStatistics VXLNumerics itkpng itkzlib ITKMetaIO Verify the Build ITKCommon ITKBasicFilters ITKAlgorithms ITKNumerics ITKFEM ITKIO Methods in Image Analysis 2004, Damion Shelton

  35. Building with gcc • Order of operations is the same • Differences • Run the ccmake executable, which uses a curses TUI, the options are identical • Run make instead of Visual Studio • Think of CMake as replacing the “./configure” step you may be used to Methods in Image Analysis 2004, Damion Shelton

  36. Building with gcc cont. Start in directory containing Insight mkdir InsightBin cd InsightBin ccmake ../Insight Edit CMake, reconfigure if needed make Methods in Image Analysis 2004, Damion Shelton

  37. Now what? • At this point, you should have two things: • A directory containing a bunch of source code (e.g. ~/Insight) • A directory containing the built ITK libraries (e.g. ~/InsightBin) • As mentioned earlier, you don’t have anything executable Methods in Image Analysis 2004, Damion Shelton

  38. Building an application • ITK comes with a simple application you can build in order to test the ITK libraries “out of source” (I.e. not built inside ITK) • It can be found in: /Insight/Examples/Installation Methods in Image Analysis 2004, Damion Shelton

  39. How to build HelloWorld • Copy & rename the Installation directory somewhere outside of the Insight directory • Run CMake on HelloWorld • Remember the source/binary distinction and use HelloWorldBin as your build location • CMake should automatically find ITK • if not, edit the ITK_DIR option Methods in Image Analysis 2004, Damion Shelton

  40. How to build HelloWorld, cont. • Once CMake is happy, generate the makefile/project for your compiler • Build HelloWorld • Give it a try Methods in Image Analysis 2004, Damion Shelton

  41. More examples • You can turn on the Examples option in CMake, which will build all of the examples for you • Or… you can copy the examples out-of-source and build them like you did HelloWorld • These examples link into ITK Software Guide; read the chapter, poke the code and see what happens… Methods in Image Analysis 2004, Damion Shelton

  42. Workflow thoughts You should get used to the idea of: • Writing some code • Writing a CMakeLists.txt file • Running CMake • Building your code • Rinse, repeat Methods in Image Analysis 2004, Damion Shelton

  43. An aside: how to use ITK withexisting applications • Your app probably does not use CMake • In this case, you need to link to the ITK libraries explicitly and include the appropriate source directories • This isn’t hard, but it may take some trial and error to discover everything you need • You don’t need to worry about this in the context of this class Methods in Image Analysis 2004, Damion Shelton

  44. Revision control with CVS • Revision control software allows you to store incremental changes to software • You will be expected to use CVS to manage your homework assignments • I encourage you to use revision control on your code outside of this class as well - it’s a good habit to develop Methods in Image Analysis 2004, Damion Shelton

  45. CVS terms • Server - what it sounds like • Module - a group of files that can be accessed on the server • User - each module has associated users, with varying levels of access (read only, read/write, etc.). Methods in Image Analysis 2004, Damion Shelton

  46. CVS terms, cont. • Checkout - Download a fresh copy of a module from the server to your computer • Update - Sync your copy of a module with the server copy; much faster than a checkout • Commit - Merge changes made to your local copy with the server Methods in Image Analysis 2004, Damion Shelton

  47. CVS setup • The CVS server for this course is: • cvs.vialab.org • You will each have a module, based on your email; Aaron will tell you about this • Only you and the instructors will have access to this module • Later, there may be group modules for the final project Methods in Image Analysis 2004, Damion Shelton

  48. CVS setup, cont. • I prefer to use a GUI wrapper for CVS • http://www.wincvs.org • Versions are available for Windows, Mac, and Linux • Windows users can also try http://www.tortoisecvs.org/ • Command line works fine too, but may be more awkward if you’re used to GUI’s Methods in Image Analysis 2004, Damion Shelton

  49. ITK Documentation • Most of the ITK documentation is generated automatically from source comments using Doxygen • Please familiarize yourself with the various means of navigating the Doxygen documentation online • http://www.itk.org/Doxygen/html/index.html Methods in Image Analysis 2004, Damion Shelton

More Related