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  

Wavelets.h

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 #undef powerof2  /* needed for Mac OS X */
00008 
00009 /*---------------------------------------------------------------------------*/
00010 /*
00011   This is the header file for software contained in Wavelets.c.
00012 
00013   File:    Wavelets.h
00014   Author:  B. Douglas Ward
00015   Date:    28 March 2000
00016 */
00017 
00018 
00019 /*---------------------------------------------------------------------------*/
00020 
00021 #define MAX_WAVELET_TYPE 2
00022 
00023 static char * WAVELET_TYPE_name[MAX_WAVELET_TYPE] =
00024   { "Haar", "Daubechies" } ;
00025 
00026 
00027 #define WA_HAAR          (0)
00028 #define WA_DAUBECHIES    (1)
00029 
00030 
00031 /*---------------------------------------------------------------------------*/
00032 /*
00033    Print error message and stop.
00034 */
00035 
00036 void WA_error (char * message);
00037 
00038 
00039 /*---------------------------------------------------------------------------*/
00040 /** macro to test a malloc-ed pointer for validity **/
00041 
00042 #define MTEST(ptr) \
00043 if((ptr)==NULL) \
00044 ( WA_error ("Cannot allocate memory") )
00045 
00046      
00047 /*---------------------------------------------------------------------------*/
00048 /*
00049   Print time series data to screen.
00050 */
00051 
00052 void ts_print (int npts, float * data);
00053 
00054 
00055 /*---------------------------------------------------------------------------*/
00056 /*
00057   Write time series data to specified file.
00058 */
00059 
00060 void ts_fprint (char * filename, int npts, float * data);
00061 
00062 
00063 /*---------------------------------------------------------------------------*/
00064 /*
00065   Calculate integer power of 2.
00066 */
00067 
00068 int powerof2 (int n);
00069 
00070 
00071 /*---------------------------------------------------------------------------*/
00072 /*
00073   Calculate integer log base 2.
00074 */
00075 
00076 int my_log2 (int n);
00077 
00078 
00079 /*---------------------------------------------------------------------------*/
00080 /*
00081   Apply filter to wavelet coefficients.
00082 */
00083 
00084 void FWT_1d_filter 
00085 (
00086   float * filter,         /* array of filter coefficients */
00087   int N,                  /* log2(NPTS) */
00088   float * s               /* array of wavelet coefficients */ 
00089 );
00090 
00091 
00092 /*---------------------------------------------------------------------------*/
00093 /*
00094   Set up array indicating which wavelet coefficients to set to zero.
00095 */
00096 
00097 float * FWT_1d_stop_filter 
00098 (
00099   int num_stop_filters,   /* number of wavelet stop filters */
00100   int * stop_band,        /* wavelet filter stop band */ 
00101   int * stop_mintr,       /* min. time for stop band */
00102   int * stop_maxtr,       /* max. time for stop band */
00103   int NFirst,             /* first image from input 3d+time dataset to use */
00104   int NPTS                /* number of usable data points from input data */
00105 );
00106 
00107 
00108 /*---------------------------------------------------------------------------*/
00109 /*
00110   Set up array indicating which wavelet coefficients to include in the model.
00111 */
00112 
00113 float * FWT_1d_pass_filter
00114 (
00115   int num_pass_filters,   /* number of wavelet pass filters */
00116   int * pass_band,        /* wavelet filter pass band */ 
00117   int * pass_mintr,       /* min. time for pass band */
00118   int * pass_maxtr,       /* max. time for pass band */
00119   int NFirst,             /* first image from input 3d+time dataset to use */
00120   int NPTS                /* number of usable data points from input data */
00121 );
00122 
00123 
00124 /*---------------------------------------------------------------------------*/
00125 /*
00126   Calculate the error sum of squares.
00127 */
00128 
00129 float calc_sse 
00130 (
00131   int NPTS,         /* number of usable data points from input data */
00132   float * trueData,     /* actual time series data */
00133   float * est       /* estimated time series data */
00134 );
00135 
00136 
00137 /*---------------------------------------------------------------------------*/
00138 /*
00139   Calculate the F-statistic for significance of the regression.
00140 */
00141 
00142 float calc_freg
00143 (
00144   int n,                      /* number of data points */
00145   int p,                      /* number of parameters in the full model */
00146   int q,                      /* number of parameters in the rdcd model */
00147   float ssef,                 /* error sum of squares from full model */
00148   float sser                  /* error sum of squares from reduced model */
00149 );
00150 
00151 
00152 /*---------------------------------------------------------------------------*/
00153 /*
00154   Calculate the coefficient of multiple determination R^2.
00155 */
00156 
00157 float calc_rsqr 
00158 (
00159   float ssef,                 /* error sum of squares from full model */
00160   float sser                  /* error sum of squares from reduced model */
00161 );
00162 
00163 
00164 /*---------------------------------------------------------------------------*/
00165 /*
00166   Perform wavelet analysis on a single input time series.
00167 */
00168 
00169 void wavelet_analysis 
00170 (
00171   int wavelet_type,         /* indicates type of wavelet */   
00172   int f,                    /* number of parameters removed by the filter */
00173   float * stop_filter,      /* select wavelet coefs. to stop */
00174   int q,                    /* number of parameters in the baseline model */
00175   float * base_filter,      /* select wavelet coefs. for baseline */
00176   int p,                    /* number of parameters in the full model */
00177   float * full_filter,      /* select wavelet coefs. for full model */
00178   int NPTS,                 /* number of usable data points from input data */
00179   float * ts_array,         /* array of measured data for one voxel */
00180 
00181   float * coef,             /* full model wavelet coefficients */
00182   float * sse_base,         /* baseline model error sum of squares */
00183   float * sse_full,         /* full model error sum of squares */
00184   float * ffull,            /* full model F-statistic */
00185   float * rfull,            /* full model R^2 stats. */
00186 
00187   float * coefts,           /* filtered FWT coefficients */
00188   float * fitts,            /* filterd time series */
00189   float * sgnlts,           /* signal model fitted time series */
00190   float * errts             /* residual error time series */
00191 );
00192 
00193 
00194 /*---------------------------------------------------------------------------*/
00195 /*
00196   Report the results of wavelet analysis for a single time series.
00197 */
00198 
00199 void report_results 
00200 (
00201   int N,                /* number of usable data points from input data */
00202   int NFirst,           /* first image from input 3d+time dataset to use */
00203   int f,                /* number of parameters removed by the filter */
00204   int p,                /* number of parameters in the full model */
00205   int q,                /* number of parameters in the baseline model */
00206   float * base_filter,  /* select wavelet coefs. for baseline */
00207   float * sgnl_filter,  /* select wavelet coefs. for full model */
00208   float * coef,         /* full model wavelet coefficients */
00209   float sse_base,       /* baseline model error sum of squares */
00210   float sse_full,       /* full model error sum of squares */
00211   float ffull,          /* full model F-statistic */
00212   float rfull,          /* full model R^2 stat. */
00213   char ** label         /* statistical summary for ouput display */
00214 );
00215 
00216 
00217 /*---------------------------------------------------------------------------*/
00218 
00219 
00220 
00221 
00222 
00223 
 

Powered by Plone

This site conforms to the following standards: