1 #include "mrilib.h"
2 
3 #include "thd_entropy16.c"
4 
main(int argc,char * argv[])5 int main( int argc , char * argv[] )
6 {
7    int iarg=1 ;
8    THD_3dim_dataset * dset ;
9    double eset ;
10 
11    if( argc < 2 || strcmp(argv[1],"-help") == 0 ){
12       printf("\n") ;
13       printf("Usage: 3dEntropy [-zskip] dataset ...\n\n") ;
14       printf(" * Datasets must be stored as 16 bit shorts.\n") ;
15       printf(" * -zskip option means to skip 0 values in the computation.\n") ;
16       printf(" * This program is not very useful :) :(\n") ;
17       PRINT_COMPILE_DATE ; exit(0) ;
18    }
19 
20    while( iarg < argc && argv[iarg][0] == '-' ){
21      if( strcasecmp(argv[iarg],"-zskip") == 0 ){
22        do_zskip++ ; iarg++ ; continue ;
23      }
24      if( strcasecmp(argv[iarg],"-perbin") == 0 ){
25        do_perbin = 1 ; do_permax = 0 ; iarg++ ; continue ;
26      }
27      if( strcasecmp(argv[iarg],"-permax") == 0 ){
28        do_perbin = 0 ; do_permax = 1 ; iarg++ ; continue ;
29      }
30      ERROR_exit("Unknown option '%s'") ; exit(1) ;
31    }
32 
33    for( ; iarg < argc ; iarg++ ){
34       dset = THD_open_dataset( argv[iarg] ) ; CHECK_OPEN_ERROR(dset,argv[iarg]) ;
35       eset = ENTROPY_dataset(dset) ;
36       printf("%s: %g\n",argv[iarg],eset) ;
37       DSET_delete(dset) ;
38    }
39    exit(0) ;
40 }
41