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  

edt_zscore.c

Go to the documentation of this file.
00001 /*****************************************************************************
00002    Major portions of this software are copyrighted by the Medical College
00003    of Wisconsin, 1994-2000, and are released under the Gnu General Public
00004    License, Version 2.  See the file README.Copyright for details.
00005 ******************************************************************************/
00006 
00007 #include "mrilib.h"
00008 
00009 /*----------------------------------------------------------------------------
00010    Convert an array of statistics to N(0,1) (or z-score) values.
00011    For t and correlation statistics, the z-scores will be signed.
00012    For other types, the statistic is always positive and so will the z-score.
00013    17 Sep 1998 -- RWCox
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    /*-- sanity checks --*/
00025 
00026    if( nvox < 1                 ||                  /* no data? */
00027        var == NULL              ||                  /* no data? */
00028        ! FUNC_IS_STAT(statcode) ||                  /* not a statistic? */
00029        statcode == FUNC_ZT_TYPE ||                  /* already a z-score? */
00030        ( vtype != MRI_short && vtype != MRI_float ) /* illegal type of data? */
00031    ) EXRETURN ;
00032 
00033    /*-- what type of data? --*/
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 }
 

Powered by Plone

This site conforms to the following standards: