pro write_tomo_volume, file, volume

;+
; NAME:
;    WRITE_TOMO_VOLUME
;
; PURPOSE:
;    Writes 3-D volume files to be read later by READ_TOMO_VOLUME. These are binary files
;    written in architecture-dependent format. These files are used for efficiency, so
;    that additional reconstructions can be done without having to re-read the raw data files
;    are re-apply the dark current, white field and zinger corrections.
;
; CATEGORY:
;    Tomography data processing
;
; CALLING SEQUENCE:
;
;    WRITE_TOMO_VOLUME, File, Volume
;
; INPUTS:
;    File: The name of the volume file to be written.
;    Volume: The 3-D volume data to be written. This mus be a 3-D 16-bit integer array. The 
;    dimensions are NX, NY, NANGLES
;
; RESTRICTIONS:
;    These files are written using the host byte order and floating point format.
;    They are thus not portable, and are intended to be used for intermediate storage only.
;    no important restrictions.
;
; EXAMPLE:
;    WRITE_TOMO_VOLUME, 'diamond2.volume', volume
;
; MODIFICATION HISTORY:
;    Written by:    Mark Rivers, May 13, 1998
;-

openw, lun, file, /get
size = size(volume)
ncols = size[1]
nrows = size[2]
nangles = size[3]
writeu, lun, ncols, nrows, nangles, volume
free_lun, lun
end