• API Main Page
  • Documentation
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

src/warping.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Matthias Ihrke   *
00003  *   mihrke@uni-goettingen.de   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00060 #ifndef WARPING_H
00061 #define WARPING_H
00062 #include "mathadd.h"
00063 #include "definitions.h"
00064 #include "time_frequency.h"
00065 #include "regularization.h"
00066 #include "eeg.h"
00067 
00068 #ifdef __cplusplus
00069 extern "C" {
00070 #endif
00071 
00072   /*-----------------------------------------------------------
00073      -  slope constraint for DTW
00074      ---------------------------------------------------------*/
00079   typedef enum {
00080      SLOPE_CONSTRAINT_NONE=0,
00081      SLOPE_CONSTRAINT_LAX,
00082      SLOPE_CONSTRAINT_MEDIUM,
00083      SLOPE_CONSTRAINT_SEVERE
00084   } SlopeConstraint;
00085 
00086   /*-----------------------------------------------------------
00087      - WARPING -
00088      ---------------------------------------------------------*/
00089 
00090   typedef struct{
00091      int *t1; 
00092      int *t2; 
00093      int n1; 
00094      int n2; 
00095      int n; 
00096   } WarpPath;
00097     
00098 
00111 #define warppath_CHECK( flag, w )                                                   \
00112   if(!( (w)->ndim==2 && (w)->dtype==UINT )){                                    \
00113      char *dts="";                                                                      \
00114      array_DTYPESTRING( dts, w->dtype );                                        \
00115      errprintf("not a warppath, ndim=%i, dtype=%s\n", w->ndim, dts );   \
00116      flag=FALSE;                                                                        \
00117   } else { flag=TRUE; }                                                             
00118   
00119   /* ---------------------------------------------------------------------------- 
00120       -- Timewarping                                                            -- 
00121       ---------------------------------------------------------------------------- */
00122 
00123   Array*  matrix_dtw_cumulate ( Array *mat, bool alloc, OptArgList *optargs );
00124   Array*  matrix_dtw_backtrack ( const Array *d );
00125 
00126   Array*  dtw_add_signals( const Array *s1, const Array *s2, const Array *path, OptArgList *opts );
00127 
00128   
00129   EEG* eeg_dtw_hierarchical( EEG *eeg_in, const double **distmatrix, 
00130                                       EEG *out, OptArgList *optargs );
00131 
00132   EEG* eeg_gibbons( EEG *eeg, int stimulus_marker, int response_marker, double k );
00133 
00134 #ifdef EXPERIMENTAL
00135   Array* multiwarp( Array *in, uint window, OptArgList *opts );
00136   Array* multiwarp_add( Array *in, Array *times, Array *path );
00137 #endif
00138 
00139   /******************************************************************/
00141   /******************************************************************/
00142 
00143   void       dtw_cumulate_matrix  ( double **d, int M, int N, OptArgList *opts );
00144   /* void dtw_cumulate_matrix_chiba_band( double **d, int M, int N, double restriction );*/
00145   WarpPath*  dtw_backtrack        ( const double **d, int M, int N, WarpPath *P );
00146 
00147    WarpPath* init_warppath ( WarpPath *path, int n1, int n2 );
00148    void      free_warppath ( WarpPath *p );
00149    void      reset_warppath( WarpPath *P, int n1, int n2 );
00150    void      print_warppath( FILE *out, WarpPath *P );
00151  
00152 #ifdef __cplusplus
00153 }
00154 #endif
00155 
00156 #endif

Generated on Fri Jun 25 2010 14:10:21 for libeegtools by  doxygen 1.7.0