ITK/Examples/Instructions/ForUsers: Difference between revisions
From KitwarePublic
< ITK | Examples | Instructions
Jump to navigationJump to search
(Superbuild documentation) |
(Updated remote module instructions) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
If you want to use [[ITK/Examples|ITK Examples]] you have several options. If you are a Wiki Example Developer, [[ITK/Examples/Instructions/ForDevelopers|go here]] or a Wiki Example Administrator [[ITK/Examples/Instructions/ForAdministrators|go here]]. | If you want to use [[ITK/Examples|ITK Examples]] you have several options. If you are a Wiki Example Developer, [[ITK/Examples/Instructions/ForDevelopers|go here]] or a Wiki Example Administrator [[ITK/Examples/Instructions/ForAdministrators|go here]]. | ||
==Build | ==Build a single example== | ||
# | # Follow the instructions at the bottom of the example. These instructions tell how to download, extract, configure, compile and run the example. | ||
From here, the instructions are operating system specific: | From here, the instructions are operating system specific: | ||
Line 27: | Line 24: | ||
==Build all of the examples== | ==Build all of the examples== | ||
If you are really | If you are really excited about learning ITK and are tired of downloading individual examples over and over, you can download them all at the same time and build them all together. | ||
* [ | * [https://github.com/InsightSoftwareConsortium/ITKWikiExamples/archive/master.zip Download a zip file] containing all examples. | ||
: | : Unzip the zip file to ''ITKWikiExamples''. | ||
:or | :or | ||
* Keep an active connection to the examples. | * Keep an active connection to the examples. | ||
# Install [http://git-scm.com/ git] | # Install [http://git-scm.com/ git] | ||
# Clone the examples repository | # Clone the examples repository | ||
<pre>git clone git:/ | <pre>git clone git@github.com:InsightSoftwareConsortium/ITKWikiExamples.git ITKWikiExamples</pre> | ||
===You have your own versions of VTK and ITK=== | ===You have your own versions of VTK and ITK=== | ||
* Make a directory to hold the binaries | * Make a directory to hold the binaries | ||
Line 48: | Line 45: | ||
The ITKWikiExamples Superbuild will grab the proper versions of VTK and ITK and build all of the examples. To take advantage of the Superbuild, you will need to install [http://git-scm.com/ git]. | The ITKWikiExamples Superbuild will grab the proper versions of VTK and ITK and build all of the examples. To take advantage of the Superbuild, you will need to install [http://git-scm.com/ git]. | ||
<pre>mkdir ITKWikiExamples-Superbuild</pre> | <pre>mkdir ITKWikiExamples-Superbuild</pre> | ||
* From this build directory, run ' | * From this build directory, run 'ccmake'. | ||
<pre> | <pre> | ||
cd ITKWikiExamples-Superbuild | cd ITKWikiExamples-Superbuild | ||
ccmake ../ | ccmake ../ITKWikiExamples/Superbuild | ||
make | make | ||
</pre> | </pre> | ||
===Build as an ITKv4 Remote Module=== | |||
* Enable fetching | |||
# Go to: https://github.com/InsightSoftwareConsortium/ITKWikiExamples/raw/master/WikiExamples.remote.cmake | |||
# Right click on the "Raw" button and select "Save Link As..." | |||
# Save the file in: YOUR_ITK_SOURCE_DIR/Modules/Remote | |||
====If you use an interactive cmake (ccmake, cmake-gui or cmakesetup)==== | |||
* Configure | |||
# Go to your itk build directory and run cmake | |||
# Configure | |||
* Fetch ITK Wiki Examples '''NOTE: Only for ITK 4.4 and earlier''' | |||
# Open the highlighted (red) cmake entry | |||
# Check the Fetch_WikiExamples box | |||
# Configure | |||
* Enable ITK Wiki Exampes | |||
# Configure (yes, do it again) | |||
# Open the highlighted (red) cmake entry | |||
# Check the Module_WikiExamples box | |||
# Configure | |||
# Generate | |||
# Exit cmake | |||
====If you use cmake from the command line==== | |||
From your itk build directory | |||
* Configure | |||
# cmake -DFetch_WikiExamples=ON YOUR_ITK_SOURCE_DIR '''NOTE: Only for ITK 4.4 and earlier''' | |||
# cmake -DModule_WikiExamples=ON YOUR_ITK_SOURCE_DIR | |||
====Once you have configured with the cmake gui or command line==== | |||
--------------------------------------- | |||
* Build ITKWikiExamples | |||
From your itk build directory | |||
# make | |||
* Test ITKWikiExamples if testing is ON | |||
# cd your itk build directory | |||
# cd Modules/Remote/WikiExamples | |||
# ctest | |||
==Find a class or method using google== | ==Find a class or method using google== | ||
Line 65: | Line 103: | ||
<pre> | <pre> | ||
cd ITKWikiExamples | cd ITKWikiExamples | ||
git pull | git pull | ||
cd ../ITKWikiExamples-build | cd ../ITKWikiExamples-build | ||
cmake ../ITKWikiExamples | cmake ../ITKWikiExamples |
Latest revision as of 17:50, 17 August 2013
If you want to use ITK Examples you have several options. If you are a Wiki Example Developer, go here or a Wiki Example Administrator go here.
Build a single example
- Follow the instructions at the bottom of the example. These instructions tell how to download, extract, configure, compile and run the example.
From here, the instructions are operating system specific:
Linux
From your build directory, run
ccmake YourSourceDirectory (to create a Unix Makefile)
or
ccmake YourSourceDirectory -G YourIDE (e.g. KDevelop3)
- Press 'c' to configure.
- If CMake finds the correct location of your VTK binary build (the VTK_DIR cmake variable), and/or the ITK binary build (the ITK_DIR cmake variable) great! If not, use the arrow keys to scroll down to VTK_DIR, press enter, type the location of your VTK binary build (likely something like /home/yourname/bin/VTK), and press enter.
- Press 'c' again to reconfigure
- Press 'g' to generate
- If you generated a Unix Makefile, type 'make' in your build directory
- If you generated a project for an IDE, open the project file with your IDE
Windows
- Open CMake
- Select your CMakeLists.txt file
- Select your build system
- Click "Generate"
Build all of the examples
If you are really excited about learning ITK and are tired of downloading individual examples over and over, you can download them all at the same time and build them all together.
- Download a zip file containing all examples.
- Unzip the zip file to ITKWikiExamples.
- or
- Keep an active connection to the examples.
- Install git
- Clone the examples repository
git clone git@github.com:InsightSoftwareConsortium/ITKWikiExamples.git ITKWikiExamples
You have your own versions of VTK and ITK
- Make a directory to hold the binaries
mkdir ITKWikiExamples-build
- From this build directory, run 'cmake'. You will be prompted for the location of your VTK and ITK binary builds.
cd ITKWikiExamples-build ccmake ../ITKWikiExamples make
Use the Superbuild to build a proper VTK and ITK
The ITKWikiExamples Superbuild will grab the proper versions of VTK and ITK and build all of the examples. To take advantage of the Superbuild, you will need to install git.
mkdir ITKWikiExamples-Superbuild
- From this build directory, run 'ccmake'.
cd ITKWikiExamples-Superbuild ccmake ../ITKWikiExamples/Superbuild make
Build as an ITKv4 Remote Module
- Enable fetching
- Go to: https://github.com/InsightSoftwareConsortium/ITKWikiExamples/raw/master/WikiExamples.remote.cmake
- Right click on the "Raw" button and select "Save Link As..."
- Save the file in: YOUR_ITK_SOURCE_DIR/Modules/Remote
If you use an interactive cmake (ccmake, cmake-gui or cmakesetup)
- Configure
- Go to your itk build directory and run cmake
- Configure
- Fetch ITK Wiki Examples NOTE: Only for ITK 4.4 and earlier
- Open the highlighted (red) cmake entry
- Check the Fetch_WikiExamples box
- Configure
- Enable ITK Wiki Exampes
- Configure (yes, do it again)
- Open the highlighted (red) cmake entry
- Check the Module_WikiExamples box
- Configure
- Generate
- Exit cmake
If you use cmake from the command line
From your itk build directory
- Configure
- cmake -DFetch_WikiExamples=ON YOUR_ITK_SOURCE_DIR NOTE: Only for ITK 4.4 and earlier
- cmake -DModule_WikiExamples=ON YOUR_ITK_SOURCE_DIR
Once you have configured with the cmake gui or command line
- Build ITKWikiExamples
From your itk build directory
- make
- Test ITKWikiExamples if testing is ON
- cd your itk build directory
- cd Modules/Remote/WikiExamples
- ctest
Find a class or method using google
Type the following into the google search bar
site:itk.org/Wiki/ITK/Examples itkMedianImageFilter
- or
site:itk.org/Wiki/ITK/Examples SetRadius
Update the examples repository
If you cloned the examples repository, you can get the latest updates:
cd ITKWikiExamples git pull cd ../ITKWikiExamples-build cmake ../ITKWikiExamples make
Run all of the examples
ctest