1 #include "mrilib.h"
2 #include "thd_conformist.c"
3
4 /*----------------------------------------------------------------------------*/
5
main(int argc,char * argv[])6 int main( int argc , char *argv[] )
7 {
8 int ndset=0 , ii ;
9 THD_3dim_dataset **dset ;
10
11 if( argc < 3 || strcasecmp(argv[1],"-help") == 0 ){
12 printf(
13 "** Program 3dConformist reads in a collection of datasets and\n"
14 " zero pads them to the same size.\n"
15 "** The output volume size is the smallest region that includes\n"
16 " all datasets (i.e., the minimal covering box).\n"
17 "** If the datasets cannot be processed (e.g., different grid\n"
18 " spacings), then nothing will happen except for error messages.\n"
19 "** The purpose of this program is to be used in scripts that\n"
20 " process lots of datasets and needs to make them all conform\n"
21 " to the same size for collective voxel-wise analyses.\n"
22 "** The input datasets ARE ALTERED (embiggened)! <<<<<<------******\n"
23 " Therefore, don't use this program casually.\n"
24 ) ;
25 exit(0) ;
26 }
27
28 mainENTRY("3dConformist") ; machdep() ; PRINT_VERSION("3dConformist") ;
29
30 ndset = argc-1 ;
31 dset = (THD_3dim_dataset **)malloc(sizeof(THD_3dim_dataset *)*ndset) ;
32 for( ii=0 ; ii < ndset ; ii++ ){
33 dset[ii] = THD_open_dataset(argv[ii+1]) ;
34 CHECK_OPEN_ERROR(dset[ii],argv[ii+1]) ;
35 }
36
37 ii = THD_conformist(ndset,dset,CONFORM_REWRITE,NULL) ;
38
39 switch(ii){
40 default: INFO_message ("3dConformist: Re-wrote %d datasets",ii) ; break ;
41 case 0: INFO_message ("3dConformist: all datasets matched OK") ; break ;
42 case -1: ERROR_message("3dConformist: bad input") ; break ;
43 case -2: ERROR_message("3dConformist: bad inputs") ; break ;
44 case -3: ERROR_message("3dConformist: can't match grids") ; break ;
45 }
46
47 exit(0) ;
48 }
49