This page is for notes on using Doxygen to document the Freesurfer source code.
Doxygen, http://www.stack.nl/~dimitri/doxygen/index.html, is a documentation system for C++, C, Java, and some other weird languages. It can generate html docs documenting a projects source code, by either extracting special tags from the source code (put there by people wanting to make use of doxygen), or doxygen attempts to build documentation from existing source.
Doxygen seems to be installed on the NMR systems, type:
Step 1 in using doxygen is the creation of a config file. A default is created by typing:
which creates a file called Doxygen.
The defaults that have been changed are the following:
20c20 < PROJECT_NAME = FreeSurfer --- > PROJECT_NAME = 33c33 < OUTPUT_DIRECTORY = ./doxygen --- > OUTPUT_DIRECTORY = 189c189 < OPTIMIZE_OUTPUT_FOR_C = YES --- > OPTIMIZE_OUTPUT_FOR_C = NO 462c462 < INPUT = utils --- > INPUT = 471c471 < FILE_PATTERNS = *.c *.cpp *.h --- > FILE_PATTERNS = 477c477 < RECURSIVE = YES --- > RECURSIVE = NO 489c489 < EXCLUDE_SYMLINKS = YES --- > EXCLUDE_SYMLINKS = NO
These changes are preliminary. Notice just the utils directory is marked to be processed. Because virtually none of the freesurfer source files have any doxygen tags, the html output produced by doxygen is mostly useless junk, or missing vast numbers of file.
To generate the html and latex docs, where $FSDEV is your git checkout, type:
cd $FSDEV doxygen
The docs are put in the ./doxygen directory. See ./doxygen/html/index.html
Default file header
The stub file header supporting Doxygen, used in the freesurfer code base, and the contents of which are found in dev/doxy-file-header, is this:
/** * @file REPLACE_WITH_FILENAME * @brief REPLACE_WITH_ONE_LINE_SHORT_DESCRIPTION * * REPLACE_WITH_LONG_DESCRIPTION_OR_REFERENCE */ /* * Original Author: REPLACE_WITH_FULL_NAME_OF_CREATING_AUTHOR * CVS Revision Info: * $Author: $ * $Date: $ * $Revision: $ * * Copyright © 2011 The General Hospital Corporation (Boston, MA) "MGH" * * Terms and conditions for use, reproduction, distribution and contribution * are found in the 'FreeSurfer Software License Agreement' contained * in the file 'LICENSE' found in the FreeSurfer distribution, and here: * * https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferSoftwareLicense * * Reporting: firstname.lastname@example.org * */
The all-caps REPLACE_WITH... items should be updated when this header is included at the top of a source file. The first section is read by Doxygen. @brief is the one-line summary, and the REPLACE_WITH_LONG_DESCRIPTION_OR_REFERENCE line can be multiple lines describing the file in detail, or at least include a reference to a paper describing the techniques used, if applicable.
The second section (the author name, CVS info and copyright message) is not read by Doxygen.
doxygen supports grouping things together: http://www.stack.nl/~dimitri/doxygen/grouping.html
what modules should be created for freesurfer? group by utility type? ie volume, surface, display
Comments and Suggestions
- Doesnt seem to allow documenting csh scripts
What special commands, http://www.stack.nl/~dimitri/doxygen/commands.html, are useful?
- Support for open-source community: example of well-documented source (using doxygen) that community can follow if they want to document the source (not making code changes)
- best approach is probably to build one file at a time, not try to 'auto-document' the whole code-base (resulting in useless documentation). start with, say, utils.h and the mri struct.
- 8 March 2006 - the next step is to devise a basic header, and also to create a config file that generates docs for a few core files, with the intent to add files to be 'doygenated' as they are completed.
- 23 Feb 2011 - wow, has it really been five years?