ITK/Examples/Instructions/ForDevelopers: Difference between revisions
DVigneault (talk | contribs) |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 14: | Line 14: | ||
* Click "Edit" in the topic section where you want to add an 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: | * Create a new page and a link to the new page by adding: | ||
[[ITK/Examples/''Topic''/''''' | [[ITK/Examples/''Topic''/'''''ExampleName''''' | '''''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. | * 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. | * Add the content and save it. | ||
* The link automatically turns blue (so it now goes to the "page" page instead of the "edit" page). | * 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. 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. | * 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. | ||
<pre> | <pre> | ||
== | ==ExampleName.cxx== | ||
</pre> | </pre> | ||
* Wrap code in tags for the language used in the example (cpp,tcl,py,java). | * Wrap code in tags for the language used in the example (cpp,tcl,py,java). | ||
Line 34: | Line 33: | ||
* '''Please''' add your name to the comments of the source code. | * '''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. | * '''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 | 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. | * Examples that only contain ITK classes. | ||
<pre> | <pre> | ||
{{ITKCMakeLists| | {{ITKCMakeLists|{{SUBPAGENAME}}}} | ||
</pre> | </pre> | ||
* Examples that use ITK and VTK classes. | * Examples that use ITK and VTK classes. | ||
<pre> | <pre> | ||
{{ITKVTKCMakeLists| | {{ITKVTKCMakeLists|{{SUBPAGENAME}}}} | ||
</pre> | </pre> | ||
* 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". | * 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 [http://www.vtk.org/Wiki/ITK/Examples/EdgesAndGradients/GradientMagnitudeImageFilter existing example pages] for guidance. | * Look at one of the [http://www.vtk.org/Wiki/ITK/Examples/EdgesAndGradients/GradientMagnitudeImageFilter existing example pages] for guidance. | ||
==Wiki Example Boilerplate== | |||
Here is boilerplate you can cut and paste to start: | |||
* An ITK only example | |||
<pre> | |||
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}}}} | |||
</pre> | |||
* An ITK/VTK example | |||
<pre> | |||
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}}}} | |||
</pre> | |||
==Check the Nightly Dashboard== | ==Check the Nightly Dashboard== | ||
If the example is a C++ program, the example should show up on the [http://www.cdash.org/CDash/index.php?project=ITKWikiExamples Nightly Dashboard] the morning after you edit the wiki page.. | If the example is a C++ program, the example should show up on the [http://www.cdash.org/CDash/index.php?project=ITKWikiExamples Nightly Dashboard] the morning after you edit the wiki page.. |
Latest revision as of 20:13, 6 May 2015
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..