Requirements

Although education of new users in the main motivation, the ITK wiki examples should also:

  1. Encourage good programming style
  2. Promote the proper and modern way to use ITK and write ITK programs
  3. Facilitate the nightly compilation and testing of examples that reside in the ITK wiki

These requirements must be met without compromising the main goal of user education.

Guidelines

All examples should follow the ITK programming style.

 if (this->Radius == radius)
   {
   return;
   }
 for (i = 0; i < this->Source->GetNumberOfPoints(); i++)
   {
   p1 = this->Source->GetPoint(i);
   [...]
   }
std::cout << "Print something" << std::endl;
rather than
cout << "Print something" << endl;
#include "itkMedianImageFilter.h"
is preferred over
#include <itkMedianImageFilter.h>
int main (int argc, char *argv{})
or, if argc and argv are not referenced in the code,
int main (int, char *[])
if (argc != 3)
  {
  std::cerr << "Usage: " << argv[0] << " Alpha InputFile OutputFile" << std::endl;
  return EXIT_FAILURE;
  }
return EXIT_SUCCESS;
otherwise
return EXIT_FAILURE;
When possible, filenames should be passed on the command line. This gives the examples utility beyond the data that is used in the specific example.
For example, this program
MedianImageFilter InputImageFile radius
would use the arguments in this manner
reader->SetFileName (argv[1]);
radius.Fill(atoi(argv[2]));
static void CreateImage(ImageType::Pointer image);
rather than
void CreateImage(ImageType::Pointer image);