/* VLib routines
/***************************************************************************
*	VLib.h - Part of ImgLib
*	Please note last saved date below
*   $Date: 2006/03/25 08:46:33 $

* A set of primitives for use in image processing. * c 1996-2002 Mark S. Cohen * This software is distributed as is with no guarantees. * Please report any errors or bug fixes to mscohen@ucla.edu * * For academic use only. Commercial users should contact * Mark Cohen for licensing information. * ************************************************************************** */ OSErr InitMessageLog( void ); OSErr LogMessage( char *ErrorString ); void GetVLibVer( char *buff ); void DBG ( char *msg ); Boolean PercentCount( int count, int max, int stepSize, int *ans ); char *ReportDataType( short data_type ); void SetTypeRange( float *outMax, float *outMin, short data_type ); void IsTrueorFalse (Boolean b, char *s); void ShowError ( OSErr error, char *where, char *msg); FILE *errfopen( char *fname, char *mode ); OSErr ck_fopen( FILE **f, char *fname, char *mode ); OSErr ck_fwrite( void *data, size_t itemSize, size_t nmemb, FILE *f ); OSErr ck_fread ( void *data, size_t itemSize, size_t nmemb, FILE *f ); OSErr ck_fclose( FILE *f ); Ptr ck_malloc( long size, char *msg ); Ptr ck_calloc( long number_of_objects, int size, char *msg ); OSErr CreateTempFile( FILE **TempFile, char **itsName ); OSErr GetFileSize( long *filesize, char *fname ); OSErr ReadLastBytes( char *fname, char *buff, long nBytes ); #ifdef MAC OSErr LockHandleToPointer( Handle h, void **p, SignedByte *state ); OSErr ck_AllocateHandle(long size, Handle *handleAddress); #endif OSErr memFree( void **theMem, char *msg ); OSErr cpy_alloc(void **destPtr, char *msg1, void *srcPtr, char *msg2); char *YorN( int theFlag ); Boolean pcByteOrder(); // i.e., LittleEndian Boolean macByteOrder();// i.e., BigEndian void lowerString( char *theString ); /* GENERIC VECTOR ROUTINES */ OSErr vmov( void *invec, int instep, void *outvec, int ostep, long vlen, int data_type); OSErr vfill(void *invec, void *fill, long vlen, int data_type); OSErr vfsmul(void *invec, int instep, void *outvec, int ostep, float scalar, long vlen, int data_type ); OSErr vsmul(void *invec, int instep, void *outvec, int ostep, void *scalar, long vlen, int data_type ); OSErr vadd( void *invec1, int step1, void *invec2, int step2, void *outvec, int out_step, long vlen, int data_type ); OSErr vsub( void *invec1, int step1, void *invec2, int step2, void *outvec, int out_step, long vlen, int data_type ); OSErr vmul( void *invec1, int step1, void *invec2, int step2, void *outvec, int out_step, long vlen, int data_type ); OSErr vdiv( void *numvec, int step1, void *denvec, int step2, float *outvec, int out_step, long vlen, int data_type ); OSErr vminmax( void *invec, long vlen, void *fmax, void *fmin, int data_type ); OSErr vfminmax( void *invec, long vlen, float *vecmax, float *vecmin, int data_type ); OSErr vsq( void *invec, int step, long vlen, int data_type ); OSErr vsqrt( void *invec, int step, long vlen, int data_type ); double vssq( void *invec, int step, long vlen, int data_type ); double vsum( void *invec, int step, long vlen, int data_type ); OSErr vabs( void *invec, int istep, void *ovec, int ostep, long vlen, int data_type ); OSErr vclr( void * vec, long vlen, int data_type); int get_datasize(int data_type); OSErr vbyteswap(void *invec, long vlen, int data_type); OSErr vbyteNswap(void *invec, long vlen, short n_bytes); OSErr ConvertToPercent( void *invec, void *refvec, void *outvec, long vlen, int data_type ); OSErr type_convert( void *inData, int inType, void *convertedData, int outType, long nPts, float *fmax, float *fmin, short *rules ); int swI( int *RevInt ); float swF( float *RevFloat ); short swS( short *RevShort ); unsigned short swUS( unsigned short *RevUShort ); unsigned int swUI( unsigned int *RevUInt ); double swD( double *RevDouble ); long swL( long *RevLong ); OSErr MoveSwap( void *Src, void *Dst, Boolean swap, short data_type ); int equalString( char *s1, char *s2 ); OSErr CountWords( char *InputString, int *NumWords ); #endif /*

*/