Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
thd_mismatch.c
Go to the documentation of this file.00001 #include "mrilib.h"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 int THD_dataset_mismatch( THD_3dim_dataset *ds1 , THD_3dim_dataset *ds2 )
00012 {
00013 THD_dataxes * dax1 , * dax2 ;
00014 THD_fvec3 fv1 , fv2 , dv ;
00015 int code ;
00016 float cd,c1,c2 ;
00017
00018 ENTRY("THD_dataset_mismatch") ;
00019
00020 if( !ISVALID_DSET(ds1) || !ISVALID_DSET(ds2) ) RETURN(-1) ;
00021
00022 dax1 = ds1->daxes ;
00023 dax2 = ds2->daxes ;
00024 code = 0 ;
00025
00026
00027
00028 if( dax1->nxx != dax2->nxx ||
00029 dax1->nyy != dax2->nyy ||
00030 dax1->nzz != dax2->nzz ) code |= MISMATCH_DIMEN ;
00031
00032
00033
00034 if( fabs(dax1->xxdel-dax2->xxdel) > 0.01*fabs(dax1->xxdel) ||
00035 fabs(dax1->yydel-dax2->yydel) > 0.01*fabs(dax1->yydel) ||
00036 fabs(dax1->zzdel-dax2->zzdel) > 0.01*fabs(dax1->zzdel) ) code |= MISMATCH_DELTA ;
00037
00038
00039
00040 if( dax1->xxorient != dax2->xxorient ||
00041 dax1->yyorient != dax2->yyorient ||
00042 dax1->zzorient != dax2->zzorient ) code |= MISMATCH_ORIENT ;
00043
00044
00045
00046 fv1 = THD_dataset_center( ds1 ) ;
00047 fv2 = THD_dataset_center( ds2 ) ;
00048 dv = SUB_FVEC3(fv1,fv2) ; cd = SIZE_FVEC3(dv) ;
00049
00050 LOAD_FVEC3(fv1,dax1->xxdel,dax1->yydel,dax1->zzdel) ; c1 = SIZE_FVEC3(fv1) ;
00051 LOAD_FVEC3(fv2,dax2->xxdel,dax2->yydel,dax2->zzdel) ; c2 = SIZE_FVEC3(fv1) ;
00052
00053 if( cd > 0.1*(c1+c2) ) code |= MISMATCH_CENTER ;
00054
00055 RETURN(code) ;
00056 }