Goals for this lecture. Lecture 4 Getting Started with ITK! Getting help. Assignments. Assignments, cont. Grading of assignments

Similar documents
The Pipeline. Lecture 17 ITK Pipeline. The pipeline idea. Image sources. Image to image filters. Input and output

Recap. Disclaimer. Goals for this lecture. C++ vs. Python. Reference & Review Material

What are advanced filters? Lecture 19 Write Your Own ITK Filters, Part2. Different output size. Details, details. Changing the input requested region

Lecture 15 Active Shape Models

2/7/18. For more info/gory detail. Lecture 8 Registration with ITK. Transform types. What is registration? Registration in ITK

Lecture 12 Level Sets & Parametric Transforms. sec & ch. 11 of Machine Vision by Wesley E. Snyder & Hairong Qi

Lecture 14 Shape. ch. 9, sec. 1-8, of Machine Vision by Wesley E. Snyder & Hairong Qi. Spring (CMU RI) : BioE 2630 (Pitt)

CSC209. Software Tools and Systems Programming.

Lecture 10 Segmentation, Part II (ch 8) Active Contours (Snakes) ch. 8 of Machine Vision by Wesley E. Snyder & Hairong Qi

COMP 3500 Introduction to Operating Systems Project 5 Virtual Memory Manager

All images are degraded

15-323/ Spring 2019 Project 4. Real-Time Audio Processing Due: April 2 Last updated: 6 March 2019

How to build Simbody 2.2 from source on Windows

Assembla & TortoiseSVN

Lecture 13 Theory of Registration. ch. 10 of Insight into Images edited by Terry Yoo, et al. Spring (CMU RI) : BioE 2630 (Pitt)

CSC209. Software Tools and Systems Programming.

Chapter 1 Getting Started

Laboratory 1: Eclipse and Karel the Robot

Lab 2 Building on Linux

LAB 0: LINUX COMMAND LINE AND SVN

CMSC 201 Spring 2017 Project 1 Number Classifier

EDGE Tutorial and Sample Project Overview

Java Program Structure and Eclipse. Overview. Eclipse Projects and Project Structure. COMP 210: Object-Oriented Programming Lecture Notes 1

Developing Android applications in Windows

Matlab for FMRI Module 1: the basics Instructor: Luis Hernandez-Garcia

CS 1110, LAB 1: EXPRESSIONS AND ASSIGNMENTS First Name: Last Name: NetID:

SECTION 1: CODE REASONING + VERSION CONTROL + ECLIPSE

Semester 2, 2018: Lab 1

Lecture 6 Linear Processing. ch. 5 of Machine Vision by Wesley E. Snyder & Hairong Qi. Spring (CMU RI) : BioE 2630 (Pitt)

Git. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015

CSE 331 Software Design & Implementation

SVN_Eclipse_at_home. 1. Download Eclipse. a. Go to: and select Eclipse IDE for Java Developers

EECE.2160: ECE Application Programming Spring 2018 Programming Assignment #1: A Simple C Program Due Monday, 1/29/18, 11:59:59 PM

CS240: Programming in C

Tips from the experts: How to waste a lot of time on this assignment

Computer Science 322 Operating Systems Mount Holyoke College Spring Topic Notes: C and Unix Overview

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

COP 3014: Spring 2018 A Guide to Using CLion

Data Management CS 4720 Mobile Application Development

TDDC88 Lab 4 Software Configuration Management

15-411/ Compiler Design

manifold Documentation

Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring Topic Notes: C and Unix Overview

CSCI 201 Lab 1 Environment Setup

Bootable duplicate: Create a bootable duplicate of your startup volume on an external hard drive, and update that duplicate regularly.

If you don t have the JDK, you will need to install it. 1. Go to

CMPSCI 187 / Spring 2015 Sorting Kata

CS2630: Computer Organization Project 2, part 1 Register file and ALU for MIPS processor Due July 25, 2017, 11:59pm

ECE 3574: Applied Software Design

SmartCVS Tutorial. Starting the putty Client and Setting Your CVS Password

SECTION 2: HW3 Setup.

Summer Assignment for AP Computer Science. Room 302

The Definitive Guide to Fractal Awesomeness with J-WildFire!

Revision control. INF5750/ Lecture 2 (Part I)

Customizing DAZ Studio

Registration: Rigid vs. Deformable

1. Introduction EE108A. Lab 1: Combinational Logic: Extension of the Tic Tac Toe Game

TA hours and labs start today. First lab is out and due next Wednesday, 1/31. Getting started lab is also out

Good afternoon, everyone. Thanks for joining us today. My name is Paloma Costa and I m the Program Manager of Outreach for the Rural Health Care

Student Success Guide

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger

Introduction to LLVM. UG3 Compiling Techniques Autumn 2018

THINGS. Setup Guide. David Allen Company

Source control with Subversion A user perspective

F17 Modern Version Control with Git. Aaron Perley

CSC 015: FUNDAMENTALS OF COMPUTER SCIENCE I

Using GitHub to Share with SparkFun a

AMath 483/583 Lecture 2

AMath 483/583 Lecture 2. Notes: Notes: Homework #1. Class Virtual Machine. Notes: Outline:

Laboratory Exercise #0

Week - 01 Lecture - 04 Downloading and installing Python

Revision Control. An Introduction Using Git 1/15

CMSC 201 Spring 2018 Project 3 Minesweeper

The requirements according to Autodesk are to be using Xcode with the 10.8 SDK(comes with it). Xcode 6 does not have this SDK.

Object-Oriented Programming CSCI-UA

CS2630: Computer Organization Project 2, part 1 Register file and ALU for MIPS processor

Slide 1 CS 170 Java Programming 1 Testing Karel

Hello! ios Development

Code Check TM Software Requirements Specification

COMP 117: Internet-scale Distributed Systems Lessons from the World Wide Web

The COS 333 Project. Robert M. Dondero, Ph.D. Princeton University

How To Upload Your Newsletter

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

HTML/CSS Lesson Plans

CSCI 1100L: Topics in Computing Lab Lab 1: Introduction to the Lab! Part I

To get started with Visual Basic 2005, I recommend that you jump right in

Describe CVS Tutorial

JUCE TUTORIALS. INTRO methodology how to create a GUI APP and how to create a Plugin.

Unifer Documentation. Release V1.0. Matthew S

COSC 2P95. Introduction. Week 1. Brock University. Brock University (Week 1) Introduction 1 / 18

NSIGHT ECLIPSE EDITION

Tips from the experts: How to waste a lot of time on this assignment

DARING CHANGES IN ENTERPRISE GUIDE WITH A SAFETY NET

CMPSCI 187 / Spring 2015 Hanoi

Lab 1: Setup 12:00 PM, Sep 10, 2017

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

Boot Camp. Dave Eckhardt Bruce Maggs

Microsoft SharePoint 2010

Sixth lecture; classes, objects, reference operator.

Transcription:

Goals for this lecture Lecture 4 Getting Started with ITK! Methods in Medical Image Analysis - Spring 2018 16-725 (CMU RI) : BioE 2630 (Pitt) Dr. John Galeotti Compile, compile, compile Learn how to use SVN & CMake Build ITK Compile several programs that use ITK Find documentation online Learn the quirks (if any) of the system you choose to use Based in part on Damion Shelton s slides from 2006 This work by John Galeotti and Damion Shelton, 2004-2018, was made possible in part by NIH NLM contract# HHSN276201000580P, and is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or send a letter to Creative Commons, 171 2nd Street, Suite 300, San Francisco, California, 94105, USA. Permissions beyond the scope of this license may be available by emailing itk@galeotti.net. The most recent version of these slides may be accessed online via http://itk.galeotti.net/ 1 2 Getting help Assignments Email your instructor Join the insight-users mailing list; instructions are at http://www.itk.org 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 3 4 Grading of assignments Assignments, cont. 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 divided into sections, with each section pass-fail. We may give opportunities to fix stupid problems before final judgment is passed Please interpret due dates as absolute, unless told otherwise Really We re happy to spend time helping you debug code, but not at 11 pm the day before the assignment is due 5 6 1

Computer requirements: recommended Your own computer is preferable Cluster machines should also work Please be aware that ITK can consume a lot of disk space during the build process Windows 7 through 10; with Visual Studio 2010, 2012, or 2015; Python 3.6 (x64) Suggest Win7x64 or Win10x64 with VS 2015 (V14) OS X Yosemite through High Sierra, X-Code, Python 3.6 (x64) Red Hat Enterprise Linux or CentOS, v7 (x64), with gcc 4.8, Python 3.6 What are the TA and I using? TA: Linux (CentOS 6.6): Anaconda Python 3.6.1 gcc 4.9.2 TA: Mac OS X High Sierra (10.13.2): Anaconda Python 3.6.2 Xcode Instructor: Mac OS X El Capitan (10.11.6): Anaconda Python 3.6.2 Xcode 8.2.1 7 8 Alternative usable computer configurations Any platform supported by ITK (Mac, Linux, etc.) If there are problems, you will have to work with us to get your code working on one of our machines. Try having us check your code before it is due. If the grader s computer can t run your code, you will have a short (but reasonable) period of time to fix it after he emails you that your code appears broken (along with what errors he got). If you are trying to make things work, but have many things to fix, then more time may be granted. For final projects, we may decide to let you show us your code running on your own machine, on a case-by-case basis. 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 9 10 So, what s it good for? What we assume you can do ITK code is easy to add to existing C++ code Also Python, C#, Java, 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!) Understand C++ and/or Python syntax Standard flow control such as for, do, calling functions, etc. Classes Inheritance For C++: Pointers, dereferencing, passing by reference Work comfortably in the operating system of your choice, using the compiler or Python environment of your choice 11 12 2

You may have not Revision control with SVN Used revision control using SVN (or CVS) Engaged in collaborative programming Written C++ code that builds on multiple platforms Used cross-platform make software (CMake or Jam, for example) Designed software using a data-flow architecture, worried about smart pointers, etc. Revision control software allows you to store incremental changes to software You will be expected to use SVN to manage your homework assignments SVN is like CVS, but better SVN is simpler than git I encourage you to use revision control on your code outside of this class as well - it s a good habit to develop 13 14 SVN terms SVN terms, cont. 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.). 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 15 16 SVN setup SVN setup, cont. The SVN server for this course will be: https://biglab.ri.cmu.edu/svn/miia18/{your user name} You will each have a module, based on your email; you will get email about this in a week or two. Only you and the instructor/ta will have access to this module GUI wrappers for SVN Windows: Tortoise SVN http://tortoisesvn.net/ Mac: svnx http://code.google.com/p/svnx/ Windows, Mac, and Linux (cross-platform): RapidSVN: http://rapidsvn.org/download/release/0.12.1/ SmartSVN: http://www.wandisco.com/subversion/download Command line works fine too, but may be more awkward if you re used to GUI s 17 18 3

Cross platform (C++) development ITK builds on a large combination of operating systems and platforms For C++, each compiler has it s own input format: Makefiles, workspaces, etc. Q: How can you possibly coordinate builds on different platforms? 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 19 20 CMake is: How CMake runs Required to build native (C++) ITK Cross-platform project generator Often simpler than particular environments Text as input Project file as output: Write a 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 Windows UNIX Mac OS X Visual Studio Solution Makefile Xcode project or Makefile 21 22 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 compilers CMakeLists.txt files are easy to perform revision control on CMakeLists.txt syntax Comment lines indicated with # Look at examples in ITK Simple example: 23 24 4

Full Example of CMakeLists.txt Steps to get started with C++ ITK & SimpleITK Pay Attention This is important for everyone for HW2 If you are compiling C++ SimpleITK, you do not need to compile ITK separately Compiling C++ SimpleITK using the SuperBuild approach automatically downloads and compiles ITK for us we ll explain more shortly 25 26 Step 0 Don t panic! Step 1 - Install CMake 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 https://simpleitk.readthedocs.io/ http://www.itk.org/itk/help/documentation.html Download a copy of the ITK Software Guide Check if CMake 3.4 is already installed on your computer. If not, Download and install a binary distribution of CMake 3.10.2 from: http://www.cmake.org/ 27 28 Step 2 - Install (Simple)ITK In source vs. out source builds Note: If you are going to compile SimpleITK (we are), then do not install ITK directly SimpleITK s SuperBuild will compile & install ITK for you Following a procedure similar to that for ITK Source Tree ITK Out Source Build Binary Tree ITKb Create a directory to hold the source and build for both SimpleITK and ITK Open a command prompt and go to the new directory Download the latest version of SimpleITK using git: 29 Common Algorithms BasicFilter Numerics IO In Source Build Common Algorithms BasicFilter Numerics IO 30 5

Why use two trees? Where Will Everything Be? Keeps your C++ source and binary code separate Minimizes the amount of damage you can do to your SVN tree We suggest that you build SimpleITK in a new folder you create named SITKBin WARNING: Because ITK is downloaded automatically by building SimpleITK, both the source and the build directories for ITK will be found inside the SITKBin directory After building the SimpleITK SuperBuild as instructed, your important stuff will be here: SimpleITK Source: SimpleITK Build: SimpleITK C++ Libraries (one or both of these two): ITK Source: ITK C++ Build: ITK C++ Libraries: 31 32 Configure - Easy Start CMake: Choosing a Compiler Run CMake Select the SOURCE directory:.\simpleitk\superbuild Select the BINARY directory:.\sitkbin CMake may ask to choose which compiler ( generator ) you want to use for compiling: On my OS X system, here are the choices: Press the Configure button 33 On Windows, choose your version of Visual Studio On OS X, choose Xcode (recommended) or Unix Makefiles On Linux, choose an appropriate Makefiles or Ninja option 34 Configure - Easy Start, cont. Configure - Easy Start, cont. 35 Disable each of these: BUILD_EXAMPLES BUILD_TESTS WRAP_*, e.g. WRAP_JAVA, WRAP_LUA, etc. To read special microscopyformat images Click the Add Entry button Fill in the dialog as shown 36 6

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 When done, click either Generate or OK Generating is usually very fast Build ITK You are now ready to actually compile C++ SimpleITK and ITK In Cmake, click Open Project This will open up Visual Studio or Xcode, etc. for your SimpleITK project Visual Studio: Build Build Solution Xcode: Product Build It will probably take somewhere between 30-300 minutes, but your mileage may vary 37 38 Verify the Build Building with Makefiles and gcc SimpleITK Libraries will be found in: SITK_BINARY / { SimpleITK-Build / } lib / { Debug, Release} ITK Libraries will be found in: SITK_BINARY / ITK-build / bin / { Debug, Release} Order of operations is the same Differences Can only configure for a debug OR a release build Run the ccmake executable, with one of these: -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_BUILD_TYPE=RELEASE ccmake uses a curses TUI, identical to the GUI Run make instead of Visual Studio Think of CMake as replacing the./configure step you may be used to 39 40 Building with Makefiles and gcc Now what? Start in the directory containing SimpleITK At this point, you have a bunch of source code and a bunch of compiled libraries As mentioned earlier, you don t yet have anything executable Edit CMake options Reconfigure if needed 41 42 7

Reminder: What Will Be Where Building an application SimpleITK Source: SimpleITK Build: SimpleITK C++ Libraries (one or both of these two): 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: ITK Source: ITK C++ Build: ITK C++ Libraries: 43 44 How to build HelloWorld How to build HelloWorld, cont. Copy & rename the Installation directory somewhere outside of the Insight directory Run CMake on Remember the source/binary distinction and use as your build location CMake should automatically find ITK if not, edit the option Once CMake is happy, generate the makefile/project for your compiler Build HelloWorld Give it a try 45 46 More examples C++ Workflow thoughts You can turn on ITK s 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 You should get used to the idea of: 1. Writing some code 2. Writing a CMakeLists.txt file 3. Running CMake 4. Building your code 5. Rinse, repeat 47 48 8

An aside: how to use ITK with existing C/C++ applications Your existing app may 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 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, e.g. selecting a Module and then selecting a Class http://www.itk.org/doxygen413/html/index.html 49 50 Assignment 2 Will be assigned next week. Please do NOT start until we have it ready Follows this pattern of CMake & Compilation Don t procrastinate! If you re going to have compiler problems, they will show up early in the course, so don t procrastinate this assignment. 51 9