next up previous
Next: new_header() Up: Brain Volume I/O Handling Previous: write_analyze_header()

open_write()  

Open a volume for writing



Synopsis


open_write( char *filename, header *hdr, FILE **fout, 
	    enum open_mode openmode,
	    char *name1, char *name2)


Description
Opens a VAPET, XPRIME or ANALYZE file for writing. On-line file compression is supported. Simply fill in the hdr->compressed entry to either the COMPRESS or GZIP define. /footnoteBits 0 and 1 determine the compression scheme for the header file, bits 2 and 3 for the data file. 00b is no compression, 01b is gnu zip (gzip) and 10b is compress. So 1001b means use "compress" for the data (.img) file and "gzip" for the header file. If the file format only contains 1 file (e.g. VAPET or XPRIME) the setting for the header is used only.

Use this function if you don't have the entire volume in memory, but wish to write data a bit at a time. Otherwise use write_volume()

The header is written and the FILE handle is set to be ready for writing data to the file.

The output file type is determined from "hdr->filetype".

name1 and name2 are the names of the file(s) that are written. For analyze format, name1 is the header file, and name2 is the data file. For other formats, name2 is an empty string, and name 1 the name of the file.

open_mode can assume two values which determine wether the file will be truncated upon opening or not.

Usage

Revision


1.0  29/10-96   Ulrik Kjems
1.1   18/10      UK  Write compressed files
1.2   18/10      UK  Write XPRIME files
1.21  14/11-97   UK  Fixed XPRIME write bug


Program listing





next up previous
Next: new_header() Up: Brain Volume I/O Handling Previous: write_analyze_header()
Ulrik Kjems
6/3/1998