ITK/Examples/Instructions/ForDevelopers

From KitwarePublic
Jump to navigationJump to search

The success of the ITK Wiki Examples depends on the contributions from the ITK user community. If you wish to contribute to this valuable resource, please follow these guidelines. If you are a Wiki Example User, go here or a Wiki Example Administrator go here.

Create an Example

C++, Tcl, Python and Java examples are welcome. Examples should illustrate a single concept.

Follow the Coding Guidelines

When you write an example, please follow the coding guidelines. Create the example on your local system, compile and run it before you store it on the wiki.

Choose a Topic

The examples are organized by topic. Current topics include etc.

Create a Wiki Page

  • If you don't already have a account, create an account or login to an existing account.
  • Go to the page for the language of the example
  • Click "Edit" in the topic section where you want to add an example.
  • Create a new page and a link to the new page by adding:
 What you want to display as the link
  • When you save these changes, there be a red link. When you click this link, it immediately brings you to the "Edit" page of the new page.
  • Add the content and save it.
  • The link automatically turns blue (so it now goes to the "page" page instead of the "edit" page).
  • Precede the code with a heading defines the filename of the example. The filename should be the same as the page name. Ensure there are no spaces between the == and the filename. The name is important!. When the example is stored in the Wiki Examples source code repository, it will have this filename and reside in the Topic directory.
==ExampleName.cxx==
  • Wrap code in tags for the language used in the example (cpp,tcl,py,java).
<source lang="cpp">
// your code here
</source>
  • Please add your name to the comments of the source code.
  • Always also post a CMakeLists.txt file so that other users will know which libraries are required.

There are two templates available that will generate proper CMakeLists.txt files. Place one of these at the bottom of the wiki page.

  • Examples that only contain ITK classes.
{{ITKCMakeLists|{{SUBPAGENAME}}}}
  • Examples that use ITK and VTK classes.
{{ITKVTKCMakeLists|{{SUBPAGENAME}}}}
  • The "Show preview" button at the bottom next to "Save page" is a good idea - it will let you play around with things and see what they look like without actually uploading them to the wiki. When you are satisfied, you can then click "Save page".
  • Look at one of the existing example pages for guidance.

Wiki Example Boilerplate

Here is boilerplate you can cut and paste to start:

  • An ITK only example
A description of the example.
Contributed by:
==ITKExample.cxx==
<source lang="cpp">
// Insert your c++ code here
int main (int argc, char *argv[])
{
  return EXIT_SUCCESS;
}
</source>
{{ITKCMakeLists|{{SUBPAGENAME}}}}
  • An ITK/VTK example
A description of the example.
Contributed by:
==ITKVTKExample.cxx==
<source lang="cpp">
// Insert your c++ code here
#include <QuickView.h>
int main (int argc, char *argv[])
{
  return EXIT_SUCCESS;
}
</source>
{{ITKVTKCMakeLists|{{SUBPAGENAME}}}}

Check the Nightly Dashboard

If the example is a C++ program, the example should show up on the Nightly Dashboard the morning after you edit the wiki page..