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  

ts.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 #ifndef MCW_TS_HEADER
00008 #define MCW_TS_HEADER
00009 
00010 /** structure type to hold data from one time series file **/
00011 
00012 typedef struct {
00013          char *fname ;    /* filename data was from (NULL=none) */
00014          int   len ;      /* number of points in time series */
00015          float *ts ;      /* pointer to actual data */
00016    } time_series ;
00017 
00018 typedef struct {
00019       int num , nall ;
00020       time_series ** tsarr ;
00021 } time_series_array ;
00022 
00023 #define INC_TSARR 8
00024 
00025 #define INIT_TSARR(name)                                                       \
00026    ( (name) = (time_series_array *) malloc( sizeof(time_series_array) ) ,      \
00027      (name)->num = 0 , (name)->nall = INC_TSARR ,                              \
00028      (name)->tsarr = (time_series **)malloc(sizeof(time_series *)*INC_TSARR) )
00029 
00030 #define ADDTO_TSARR(name,tsname) \
00031  do{ int nn ;                                                                               \
00032      if( (name)->num == (name)->nall ){                                                     \
00033        (name)->nall += INC_TSARR ; nn = sizeof(time_series *) * (name)->nall ;              \
00034        (name)->tsarr = ((name)->tsarr == NULL) ? (time_series **)malloc(nn)                 \
00035                                                : (time_series **)realloc((name)->tsarr,nn); \
00036        if( name->tsarr == NULL ){                                                           \
00037           fprintf(stderr,"ADDTO_TSARR malloc fails at line %d in file %s\n",                \
00038                   __LINE__,__FILE__) ; exit(1) ;                                            \
00039        } }                                                                                  \
00040      nn = (name)->num ; (name)->tsarr[nn] = (tsname) ; (name)->num++ ; break ; } while(0)
00041 
00042 #define DESTROY_TSARR(name)                                                                \
00043   do{ int ii ;                                                                             \
00044       if( (name) != NULL )                                                                 \
00045          for( ii=0 ; ii < (name)->num ; ii++ ) RWC_free_time_series((name)->tsarr[ii]) ;   \
00046       free((name)->tsarr) ; free((name)) ; (name) = NULL ; break ; } while(0)
00047 
00048 extern time_series * RWC_read_time_series() ;   /* more declarations */
00049 extern float         RWC_norm_ts() ;
00050 extern float         RWC_max_ts() ;
00051 extern float         RWC_min_ts() ;
00052 extern void          RWC_free_time_series() ;
00053 extern time_series * RWC_blank_time_series() ;
00054 extern void          RWC_medfilt_time_series() ;
00055 
00056 #define MALLOC_ERR(str) \
00057      { fprintf(stderr,"MALLOC error: %s\n",str); exit(-1); }
00058 
00059 #ifndef MIN
00060 #  define MIN(x,y) (((x)<(y)) ? (x) : (y))
00061 #endif
00062 
00063 #ifndef MAX
00064 #  define MAX(x,y) (((x)>(y)) ? (x) : (y))
00065 #endif
00066 
00067 #endif
 

Powered by Plone

This site conforms to the following standards: