Doxygen Source Code Documentation
agni_to_afni.c File Reference
#include "mrilib.h"
Go to the source code of this file.
Functions | |
int | main (int argc, char *argv[]) |
Function Documentation
|
convert DTIStudio fiber format data to SUMA segment data Definition at line 7 of file agni_to_afni.c. References ADN_datum_all, ADN_func_type, ADN_none, ADN_ntt, ADN_nvals, ADN_prefix, ADN_type, argc, DSET_ARRAY, DSET_NX, DSET_NY, DSET_NZ, DSET_write, EDIT_dset_items(), EDIT_empty_copy(), EDIT_substitute_brick(), free, FUNC_FIM_TYPE, HEAD_FUNC_TYPE, and THD_open_dataset().
00008 { 00009 THD_3dim_dataset *iset , *oset ; 00010 char *prefix = "agni" ; 00011 int iarg=1 , *vmap , ii,nxyz ; 00012 byte *bmap ; 00013 00014 if( argc < 2 || strcmp(argv[1],"-help") == 0 ){ 00015 printf("Usage: agni_to_afni [-prefix ppp] dset\n") ; 00016 exit(0) ; 00017 } 00018 00019 if( strcmp(argv[iarg],"-prefix") == 0 ){ 00020 prefix = argv[++iarg] ; iarg++ ; 00021 } 00022 00023 iset = THD_open_dataset( argv[iarg] ) ; 00024 if( iset == NULL ){ 00025 fprintf(stderr,"Can't open %s\n",argv[iarg]); exit(1); 00026 } 00027 if( iset->ag_sname == NULL ){ 00028 fprintf(stderr,"%s has no .SURF file\n",argv[iarg]); exit(1); 00029 } 00030 AGNI_load( iset ) ; 00031 if( iset->ag_surf == NULL ){ 00032 fprintf(stderr,"%s can't load .SURF file\n",argv[iarg]); exit(1); 00033 } 00034 00035 oset = EDIT_empty_copy(iset) ; 00036 EDIT_dset_items( oset , 00037 ADN_prefix , prefix , 00038 ADN_ntt , 0 , 00039 ADN_nvals , 1 , 00040 ADN_type , HEAD_FUNC_TYPE , 00041 ADN_func_type,FUNC_FIM_TYPE , 00042 ADN_datum_all, MRI_byte , 00043 ADN_none ) ; 00044 EDIT_substitute_brick( oset , 0 , MRI_byte , NULL ) ; 00045 00046 vmap = iset->ag_vmap ; 00047 if( vmap == NULL ){ 00048 vmap = AGNI_map_dset_to_surf( iset->ag_surf , iset ) ; 00049 if( vmap == NULL ){ 00050 fprintf(stderr,"Can't AGNI_map_dset_to_surf\n"); exit(1); 00051 } 00052 } 00053 00054 nxyz = DSET_NX(oset) * DSET_NY(oset) * DSET_NZ(oset) ; 00055 bmap = DSET_ARRAY(oset,0) ; 00056 for( ii=0 ; ii < nxyz ; ii++ ) 00057 bmap[ii] = (vmap[ii] >= 0) ; 00058 free(vmap) ; 00059 DSET_write(oset) ; exit(0) ; 00060 } |