Main Page | Modules | Files | Functions | Code Elements | Data Structures | Deprecated

Introduction to the ITK Function Reference

P10000.1.0.20130429.00

General Notes

Function input arguments always precede output arguments.

All ITK functions return the token ITK_ok if successful and an integer error code if not successful. This allows a C program to test the return value as if it were a logical value, although in this case, 0 (false) means success, and non-zero (true) means error.

Many functions return data in memory which has been allocated internally. The relevant arguments are marked as:

(OF)

This data should be discarded when no longer needed, by calling MEM_free with the relevant argument.

If a function fails, it will usually return a NULL in the relevant argument instead of a pointer to valid data. This NULL need not be handed to the function MEM_free as no internal allocation has occurred. However, since MEM_free ignores NULL values, it is safe to pass it the (OF) argument whether the function failed or succeeded.

Many functions perform the same operation on several instances, either explicitly listed ones or those resulting from the execution of an enquiry. If the operation fails on any one of the instances, then the function has no effect on any of the instances.

Functions that fail while acting upon many instances will return the failure code associated with the first detected cause of failure and will immediately abort the operation.

The naming convention for functions is:

XXX_name_definition

Where, XXX is the CAPITALIZED abbreviation for the module (e.g., POM for Persistent Object Manager), name is an action and definition is an action modifier or object type.

ITK Families and Generic Placeholders

ITK contains many groupings of calls that can best be described as "families" because all members of the family perform the same function, but each member acts on a different type of data.

In order to minimize redundancies and to promote usability, a generic placeholder <type> is consistently used to represent different data types in function names and in the arguments passed to these functions.

Because of minor differences in the way memory is allocated to each data type, the actual substitutions for the generic placeholder (<type>) in arguments is often slightly different than the actual name of the data type. For example, consider the following ITK family:

PROP_set_value_<type>

In order to call the function to set a string value, the data type string must be substituted for the generic placeholder <type> in the function name. Therefore, the actual function name is:

PROP_set_value_string

However, the argument passed to this function (as shown in the synopsis) is:

const char* value (I)

Generic Placeholder Substitution Table

The following table lists each data type used by ITK families and provides the proper generic placeholder substitutions for both the function name and arguments.

Name

Argument

Description
char char Single character
date date_t Date
double double Double-precision floating point decimal
int int Integer
logicallogical Logical
string char*
const char*

Character string or note. The recommended practice is to use char* for output arguments and const char* for input arguments.

tag tag_t Unique identifier of a reference (typed, untyped, or external ) or a relation (typed or untyped)

Note:
Some ITK modules may not accept all of the above data types as substitutions for the <type> generic placeholder. These exceptions will be documented for each ITK module.