Using and Customizing Templates

The BASIS Project Templates define how the basisproject utility performs quick project setup with mad-libs style text substitution. In other words, the template defines what substitution options are available when you run the basisproject command, and what files are created in a new or updated project.

Available Templates

Name Version Description
basis 1.1 This is the default template provided by BASIS and the one we recommend. It is easy to get started with and follows all of the BASIS Standards. To use it simply follow the Quick Start.
sbia 1.8 The original template for the Section of Biomedical Image Analysis (SBIA) of the University of Pennsylvania. This template will only be useful as an example for those that are not a member of this group.
custom n/a You can create your own custom template. For instructions see the Create a Custom Template section below.

You can find the actual templates provided by BASIS in the data/templates directory.

Use a Template

To use a template provided by BASIS or one that you have created, specify the name of the template including the version as subdirectory as part of the basisproject command as follows:

basisproject create --name MyProject --template basis/1.1

If you want to use your own custom template, simply specify the full path to the respective template directory which contains the template configuration file named _config.py. A relative file path must be relative to the current working directory. Other than that you can use your custom template in the same manner as described in The How-To on Creating and Modifying a Project.

Change the Default Template

During the installation of BASIS, it is possible to specify a custom template as the default used by basisproject when called without the --template argument. See the CMake Options for details.

Create a Custom Template

The template includes the files that are generated and the parameters that are available to the basisproject utility. If you plan to create new projects frequently and have some special requirements or files that you need it may be worthwhile to create a custom template. That way everything can be instantly set up in exactly the way you need.

See also

The Project Template Standard explains the layout of templates, versioning, and how custom substitutions work.

In addition to creating new projects from an existing project template, the basisproject command-line tool can also be used to generate a new Project Template customized for your needs.

The fastest way to create a new template is to call basisproject with the name of the new template and the option --new-template. Use :

basisproject create --name MyTemplate --new-template [--optional-command-options]

This will create a subdirectory called MyTemplate/1.0 under the current working directory and populate it with the current default project template structure and BASIS configuration. To copy an entire existing template, use the --full option and possibly --template to specify the location or name and version of the existing template.

For a detailed description and overview of the available command options, please refer to the output of the basisproject help create command. The template options of the existing template can be used to specify which features to copy when creating the new template.

With this you can modify the the default substitutions and file contents for your needs. You can also create new versions so that users can update their source tree automatically as you improve and update your customized template.