Doxygen Source Code Documentation
bbb.c File Reference
#include "mrilib.h"Go to the source code of this file.
Defines | |
| #define | ERR (fprintf(stderr,"\aerror\n"),exit(1)) |
Functions | |
| int | main (int argc, char *argv[]) |
Define Documentation
|
|
|
Function Documentation
|
||||||||||||
|
convert DTIStudio fiber format data to SUMA segment data Definition at line 5 of file bbb.c. References AFNI_suck_file(), argc, B64_set_crlf(), B64_set_linelen(), B64_to_base64(), B64_to_binary(), COX_clock_time(), COX_cpu_time(), ERR, and THD_filesize().
00006 {
00007 byte *b64 , *bin;
00008 int nb64 , nbin ;
00009 double cpu , clk ;
00010
00011 if( argc < 3 ) ERR ;
00012
00013 if( argv[1][0] == 'd' ){
00014 clk = COX_clock_time() ;
00015 b64 = AFNI_suck_file( argv[2] ) ;
00016 clk = COX_clock_time() - clk ;
00017 if( b64 == NULL ) ERR ;
00018 nb64 = strlen(b64) ; if( nb64 < 4 ) ERR ;
00019
00020 cpu = COX_cpu_time() ;
00021 B64_to_binary( nb64,b64 , &nbin,&bin ) ;
00022 cpu = COX_cpu_time() - cpu ;
00023 fprintf(stderr,"nbin=%d nb64=%d cpu=%g I/O=%g\n",nbin,nb64,cpu,clk) ;
00024 if( nbin == 0 ) ERR ;
00025 fwrite( bin,1,nbin,stdout ) ; exit(0) ;
00026 } else if( argv[1][0] == 'e' ){
00027 B64_set_crlf(1) ;
00028 B64_set_linelen( 72 ) ;
00029 clk = COX_clock_time() ;
00030 bin = AFNI_suck_file( argv[2] ) ;
00031 clk = COX_clock_time() - clk ;
00032 if( bin == NULL ) ERR ;
00033 nbin = THD_filesize( argv[2] ) ;
00034 if( nbin <= 0 ) ERR ;
00035 cpu = COX_cpu_time() ;
00036 B64_to_base64( nbin,bin , &nb64,&b64 ) ;
00037 cpu = COX_cpu_time() - cpu ;
00038 fprintf(stderr,"nb64=%d nbin=%d cpu=%g I/O=%g\n",nb64,nbin,cpu,clk) ;
00039 if( nb64 == 0 ) ERR ;
00040 fwrite( b64,1,nb64,stdout ) ; exit(0) ;
00041 } else {
00042 ERR ;
00043 }
00044 }
|