Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

thd_mismatch.c File Reference

#include "mrilib.h"

Go to the source code of this file.


Functions

int THD_dataset_mismatch (THD_3dim_dataset *ds1, THD_3dim_dataset *ds2)

Function Documentation

int THD_dataset_mismatch THD_3dim_dataset   ds1,
THD_3dim_dataset   ds2
 

Definition at line 11 of file thd_mismatch.c.

References THD_3dim_dataset::daxes, ENTRY, ISVALID_DSET, LOAD_FVEC3, MISMATCH_CENTER, MISMATCH_DELTA, MISMATCH_DIMEN, MISMATCH_ORIENT, THD_dataxes::nxx, THD_dataxes::nyy, THD_dataxes::nzz, RETURN, SIZE_FVEC3, SUB_FVEC3, THD_dataset_center(), THD_dataxes::xxdel, THD_dataxes::xxorient, THD_dataxes::yydel, THD_dataxes::yyorient, THD_dataxes::zzdel, and THD_dataxes::zzorient.

Referenced by main(), and VL_command_line().

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 ;           /* will be return value */
00025 
00026    /* check if the number of voxels in each direction is the same */
00027 
00028    if( dax1->nxx != dax2->nxx ||
00029        dax1->nyy != dax2->nyy ||
00030        dax1->nzz != dax2->nzz   ) code |= MISMATCH_DIMEN ;
00031 
00032    /* check if the grid spacings are the same */
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    /* check if the orientations are the same */
00039 
00040    if( dax1->xxorient != dax2->xxorient ||
00041        dax1->yyorient != dax2->yyorient ||
00042        dax1->zzorient != dax2->zzorient   ) code |= MISMATCH_ORIENT ;
00043 
00044    /* check if they have the same centers */
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 }
 

Powered by Plone

This site conforms to the following standards: