Reading and Writing General Transforms

General transforms are stored in files in an ascii format devised at the McConnell Brain Imaging Centre, and usually have a filename extension of .xfm. The input and output functions are:

public  Status  output_transform_file(
    STRING              filename,
    STRING              comments,
    General_transform   *transform )
public  Status  output_transform(
    FILE                *file,
    STRING              filename,
    int                 *volume_count_ptr,
    STRING              comments,
    General_transform   *transform )

These two functions write the general transform to a file, in the appropriate format. The comments line is an arbitrary string which is stored in the file for documentation purposes. Newline characters in the comments correctly result in a multi-line comment with a comment character inserted at the beginning of each line. The first form opens the file, with a default extension of .xfm, writes the transform, then closes the file. The second form of the function assumes the file is already open and will later be closed. Because the transform may contain pointers to MINC files that define the transform, the name of the file must be passed in to this function, to be used to create the name of the MINC files. The volume_count_ptr must point to an integer that has been initialized. Each time an auxiliary MINC file of the transform is created, the integer is used to create a unique filename, and then the volume_count_ptr is incremented. Both functions return ERROR or OK.

public  Status  input_transform(
    FILE                *file,
    STRING              filename,
    General_transform   *transform )
public  Status  input_transform_file(
    STRING              filename,
    General_transform   *transform )

Inputs a general transform from a file. The first form assumes the file has already been opened for input, and will later be closed. The second form opens the file for input, with a default extension of .xfm, reads the transform, then closes the file. Both functions return ERROR or OK.

public  STRING  get_default_transform_file_suffix()

Returns a pointer to a string consisting of the default suffix for transform files, currently ``xfm''. This pointer should not be freed or its contents modified.