Doxygen Source Code Documentation
        
Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search   
edt_zscore.c
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 #include "mrilib.h"
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 void EDIT_zscore_vol( int nvox ,
00017                       int vtype , float vfac , void * var ,
00018                       int statcode , float * stataux )
00019 {
00020    register int ii ;
00021 
00022 ENTRY("EDIT_zscore_vol") ;
00023 
00024    
00025 
00026    if( nvox < 1                 ||                  
00027        var == NULL              ||                  
00028        ! FUNC_IS_STAT(statcode) ||                  
00029        statcode == FUNC_ZT_TYPE ||                  
00030        ( vtype != MRI_short && vtype != MRI_float ) 
00031    ) EXRETURN ;
00032 
00033    
00034 
00035    switch( vtype ){
00036 
00037       case MRI_float:{
00038          register float * bar = (float *) var ;
00039          register float   fac = (vfac != 0.0 ) ? vfac : 1.0 ;
00040 
00041          for( ii=0 ; ii < nvox ; ii++ )
00042             bar[ii] = THD_stat_to_zscore( fac*bar[ii] , statcode , stataux ) ;
00043       }
00044       break ;
00045 
00046       case MRI_short:{
00047          register short * bar = (short *) var ;
00048          register float   fac = (vfac != 0.0 ) ? vfac : 1.0 ;
00049 
00050          for( ii=0 ; ii < nvox ; ii++ )
00051             bar[ii] = (short) (  FUNC_ZT_SCALE_SHORT
00052                                * THD_stat_to_zscore(fac*bar[ii],statcode,stataux) ) ;
00053       }
00054       break ;
00055    }
00056 
00057    EXRETURN ;
00058 }