/*
A set of primitives to manipulate analyze headers
c1999-2002 Mark S. Cohen
* Please do not distribute without express permission of the author.
*
* Users making changes or extensions to this software are instructed
* to notify the author of any such changes (in the interest of keeping
* this material up to date and bug-free)
*
* The author makes no representation of the suitability of this software
* for any particular purposes, nor does he certify the accuracy of the
* algorithms provided.
*
* Please report any errors or bug fixes to mscohen@ucla.edu
*
* For academic use only. Commercial users should contact
* Mark Cohen for licensing information.
*
*******************************************************************************
* EmptyAnaHdr
* Return an analyze header with most basic fields populated with reasonable values
*
* OSErr EmptyAnaHdr( dsr *DSR, -- pre-allocated memory
* char *description, -- text description
* float sliceSpacing, -- center to center slice spacing
* int xs, int ys, int n_slices,
* int time_pts,
* char orient )
*
* Caller should consider adding content to:
*
* dsr.dime.pixdim[1] -- the x pixel size
* dsr.dime.pixdim[2] -- the y pixel size
* glmax and glmin -- the global max and min
* DSR.hist.aux_file -- 24 characters of file name
*******************************************************************************
* ImageToAnalyzeHeader
* OSErr ImageToAnalyzeHeader( IMAGE *im, -- populated IMAGE struct
* dsr *DSR, -- allocated memory
* short *result ) -- data range result code
*
* Create an analyze header (dsr) based on an IMAGE struct
* populating any known fields
*******************************************************************************
* ShowAnalyzeHeader
* void ShowAnalyzeHeader( dsr *DSR, -- populated dsr (analyze struct)
* FILE *fp, -- output file
* char *name ) -- Name to display
* Display, using fprintf, the contents of an analyze header in a human readable form.
*******************************************************************************
* swapHdrBytes
* short swapHdrBytes( void *Hdr )
* byte swap the contents of the analyze header.
*
* Note that longs on the DEC are 8 bytes, and ints are 4
* whereas on the Sun, longs are 4 and ints are 2