Doxygen Source Code Documentation
thd_center.c File Reference
#include "mrilib.h"
Go to the source code of this file.
Functions | |
THD_fvec3 | THD_dataset_center (THD_3dim_dataset *dset) |
Function Documentation
|
Definition at line 8 of file thd_center.c. References THD_3dim_dataset::daxes, ENTRY, ISVALID_DSET, LOAD_FVEC3, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, RETURN, THD_3dmm_to_dicomm(), THD_dataxes::xxdel, THD_dataxes::xxorg, THD_fvec3::xyz, THD_dataxes::yydel, THD_dataxes::yyorg, THD_dataxes::zzdel, and THD_dataxes::zzorg. Referenced by main(), and THD_dataset_mismatch().
00009 { 00010 THD_dataxes * daxes ; 00011 THD_fvec3 fv1 , fv2 ; 00012 00013 ENTRY("THD_dataset_center") ; 00014 00015 if( !ISVALID_DSET(dset) ){ LOAD_FVEC3(fv1,0,0,0); RETURN(fv1); } 00016 00017 daxes = dset->daxes ; 00018 00019 LOAD_FVEC3(fv1 , daxes->xxorg , daxes->yyorg , daxes->zzorg) ; 00020 fv1 = THD_3dmm_to_dicomm( dset , fv1 ) ; 00021 00022 LOAD_FVEC3(fv2 , daxes->xxorg + (daxes->nxx-1)*daxes->xxdel , 00023 daxes->yyorg + (daxes->nyy-1)*daxes->yydel , 00024 daxes->zzorg + (daxes->nzz-1)*daxes->zzdel ) ; 00025 fv2 = THD_3dmm_to_dicomm( dset , fv2 ) ; 00026 00027 fv1.xyz[0] = 0.5*(fv1.xyz[0]+fv2.xyz[0]) ; 00028 fv1.xyz[1] = 0.5*(fv1.xyz[1]+fv2.xyz[1]) ; 00029 fv1.xyz[2] = 0.5*(fv1.xyz[2]+fv2.xyz[2]) ; 00030 00031 RETURN(fv1) ; 00032 } |