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  

uuu3.c File Reference

#include "mrilib.h"

Go to the source code of this file.


Defines

#define NEAR1   0.999

Functions

void set_unusuality_tail (float p)
void find_unusual_correlations (int nrin, float *rr, int *nhi, int *ihi)

Variables

float zstar = 0.0
float pstar = 0.0

Define Documentation

#define NEAR1   0.999
 

Definition at line 20 of file uuu3.c.

Referenced by find_unusual_correlations().


Function Documentation

void find_unusual_correlations int    nrin,
float *    rr,
int *    nhi,
int *    ihi
 

Definition at line 29 of file uuu3.c.

References free, getenv(), malloc, NEAR1, nr, qmed_float(), set_unusuality_tail(), strtod(), and zstar.

Referenced by UC_unusuality().

00031 {
00032    register int ii,jj,nr ;
00033    register float *zz ;
00034    float zmid,zsig,zmed , rmid,rcut ;
00035 
00036    if( nhi == NULL ) return ;  /* illegal entry */
00037 
00038    *nhi = 0 ;                  /* default return */
00039 
00040    if( nrin < 1000 || rr == NULL || ihi == NULL  ) return ;  /* illegal entry */
00041 
00042    /*-- make workspace --*/
00043 
00044    zz = (float *) malloc(sizeof(float)*nrin) ;
00045 
00046    if( zstar <= 0.0 ){               /* initialize zstar if needed */
00047       char * cp = getenv("PTAIL") ;
00048       float pp = 0.0001 ;
00049       if( cp != NULL ){
00050          float xx = strtod( cp , NULL ) ;
00051          if( xx > 0.0 && xx < 1.0 ) pp = xx ;
00052       }
00053       set_unusuality_tail( pp ) ;
00054    }
00055 
00056    /*-- copy data into workspace (eliding 1's) --*/
00057 
00058    for( ii=jj=0 ; ii < nrin ; ii++ )
00059       if( rr[ii] <= NEAR1 ) zz[jj++] = rr[ii] ;
00060    nr = jj ;
00061    if( nr < 2 ){ free(zz); return; } /* shouldn't happen */
00062 
00063    rmid = qmed_float( nr , zz ) ;  /* median of correlations */
00064    zmid = atanh(rmid) ;            /* median of atanh(rr) */
00065 
00066    /*-- zz <- fabs( tanh( atanh(zz) - atanh(rmid) ) ) --*/
00067 
00068    for( ii=0 ; ii < nr ; ii++ )
00069       zz[ii] = fabs( (zz[ii]-rmid)/(1.0-zz[ii]*rmid) ) ;
00070 
00071    /*-- find MAD of atanh(rr) --*/
00072 
00073    zmed = qmed_float( nr , zz ) ; /* MAD = median absolute deviation of rr */
00074    zmed = atanh(zmed) ;           /* MAD of atanh(rr) */
00075    zsig = 1.4826 * zmed ;         /* estimate standard dev. of atanh(rr) */
00076                                   /* 1.4826 = 1/(sqrt(2)*erfinv(0.5))    */
00077    free(zz) ;
00078 
00079    if( zsig <= 0.0 ) return ; /* shouldn't happen */
00080 
00081    /*-- find values of correlation greater than threshold --*/
00082    /*-- that is, with (atanh(rr)-zmid)/zsig > zstar       --*/
00083 
00084    rcut = tanh( zsig*zstar + zmid ) ;
00085 
00086    for( ii=jj=0 ; ii < nrin ; ii++ )
00087       if( rr[ii] >= rcut && rr[ii] <= NEAR1 ) ihi[jj++] = ii ;
00088 
00089    *nhi = jj ; return ;
00090 }

void set_unusuality_tail float    p
 

Definition at line 11 of file uuu3.c.

References p, pstar, qginv(), and zstar.

Referenced by CORREL_main(), find_unusual_correlations(), main(), UC_unusuality(), and unusuality().

00012 {
00013    if( p > 0.0 && p < 1.0 ){
00014       zstar = qginv(p) ;
00015       pstar = p ;
00016    }
00017    return ;
00018 }

Variable Documentation

float pstar = 0.0 [static]
 

Definition at line 9 of file uuu3.c.

Referenced by set_unusuality_tail().

float zstar = 0.0 [static]
 

Definition at line 8 of file uuu3.c.

Referenced by find_unusual_correlations(), and set_unusuality_tail().

 

Powered by Plone

This site conforms to the following standards: