// file: $(NEDC_NFC)/class/cpp/Edf/Edf.h // // Revision History: // // 20240413 (JP): rounded the sample frequency in get_sample_frequency // // 20240307 (JP): refactored code to expand set/get methods // // 20220229 (JP): added a copy header method // // 20200618 (JP): moved some constants to Itgl. // // 20200520 (JP): refactored the code // // 20200423 (JP): fixed a lot of crap including problems with dur_rec // // 20180103 (JM): removed whitepace padding from deidentify method // // 20170906 (EK): changed MAX_LSTR_LENGTH from 999 to 9999. Edf::remove()'s // local var `sstr' needed this increase in some cases. // // 20170613 (JP): removed an extra argument from deidentify; moved a few // things around in the class to support fast deidentification // // 20170114 (SL): modified the definition of the variable that holds the // data record duration (hdr_ghdi_dur_rec_d) in the header to // double // 20170103 (SL): added set_start_date method // // 20160722 (SL): added create_directory method // // 20160711 (JP): removed some includes and cleaned up the code // // 20160621 (JM): added Kaldi ark functionality // methods added: write_features_kaldi, read_features_kaldi, // is_kaldi // 20150705 (JP): updated for gcc v5.1.0 // // 20150702 (FG): interpolation moved to Edf class // methods added: interpolate, interpolate_average // // 20150623 (GS): edited parse_montage method // methods added: set_num_chans // // 20150613 (FG): added check_montage functionality // methods added: check_montage, get_montage_channels // // 20150612 (FG): added interpolation functionality // methods added: add_channel, select_channel, get_chan_pos // // 20141216 (AH): added set_sample_frequency method // make sure definitions are only made once // #ifndef NEDC_EDF #define NEDC_EDF // include nedc classes // #include // boost include files // #include #include // system include files (additional) // #include // system libraries #include // directory processing // set up associated namespaces // using namespace boost::numeric::ublas; // special definitions: // these typedefs are used to describe signal and fature vectors // typedef vector VectorBool; typedef vector VectorLong; typedef vector VectorDouble; typedef vector VVectorLong; typedef vector VVectorDouble; typedef vector VVVectorDouble; typedef matrix MatrixDouble; typedef vector VMatrixDouble; // Edf: a class that supports simple manipulation of EDF files. This // includes reading the header, loading the signal data, and // writing various feature file formats. // class Edf { //-------------------------------------------------------------------------- // // public constants // //-------------------------------------------------------------------------- public: // define the class name // static const char* CLASS_NAME; //---------------------------------------- // // string constants // //---------------------------------------- // values used in parameter files // static const char* NULL_NAME; static const char* VALUE_DELIMITER; static const char* VALUE_FNMOD; // values used to parse special files // static const char* ANNOTATION; // post-processing exceptions related parameters // static const char* ENERGY; static const char* CEPSTRAL; static const char* MINMAX_DIFF; // variable type names // static const char* VTYPE_NAME_00; static const char* VTYPE_NAME_01; static const char* VTYPE_NAME_02; static const char* VTYPE_NAME_03; // signal and feature i/o related parameters // static const long MAX_NCHANS = 256; static const long MAX_TMP_BSIZE = 99999; //---------------------------------------- // // EDF header-related constants: // most sections of the header can be read in fixed length blocks. // this reduces I/O overhead. // //---------------------------------------- static const long EDF_BSIZE = 256; static const long FLIST_BSIZE = 32768; static const long EDF_VERS_BSIZE = 8; static const char* EDF_VERS; static const char* EDF_FTYP; static const long EDF_LPTI_BSIZE = 80; static const long EDF_LPTI_TSIZE = 119; static const long EDF_LRCI_BSIZE = 80; static const long EDF_LRCI_TSIZE = EDF_LPTI_TSIZE; static const long EDF_LRCI_RSIZE = EDF_LPTI_BSIZE; static const long EDF_GHDI_BSIZE = 8 + 8 + 8 + 5 + 39 + 8 + 8 + 4; static const long EDF_GHDI_TSIZE = EDF_LPTI_TSIZE; static const long EDF_LABL_BSIZE = 16; static const long EDF_TRNT_BSIZE = 80; static const long EDF_PDIM_BSIZE = 8; static const long EDF_PMIN_BSIZE = 8; static const long EDF_PMAX_BSIZE = 8; static const long EDF_DMIN_BSIZE = 8; static const long EDF_DMAX_BSIZE = 8; static const long EDF_PREF_BSIZE = EDF_TRNT_BSIZE; static const long EDF_RECS_BSIZE = 8; static const long EDF_FTYP_BSIZE = 5; static const short int EDF_SIG_MAXVAL = (short int)32767; //---------------------------------------- // // channel selection-related constants // //---------------------------------------- // enumerations related to selection mode // enum SELECT_MODE {SELMODE_SELECT = 0, SELMODE_REMOVE, DEF_SELECT_MODE = SELMODE_SELECT}; // enumerations related to match mode // enum MATCH_MODE {MATMODE_EXACT = 0, MATMODE_PARTIAL, DEF_MATCH_MODE = MATMODE_EXACT}; // enumerations related to selection mode // enum INTERPOLATE_MODE {INTMODE_NONE = 0, INTMODE_AVERAGE, DEF_INTERPOLATE_MODE = INTMODE_NONE}; // enumerations related to interpolate output mode // enum INTERPOLATE_OMODE {INTOMODE_REPLACE = 0, INTOMODE_CONCAT, DEF_INTERPOLATE_OMODE = INTOMODE_CONCAT}; //---------------------------------------- // // test signal-related constants // //---------------------------------------- static double EDF_TST_F1; static double EDF_TST_A1; static double EDF_TST_F2; static double EDF_TST_A2; static double EDF_TST_F3; static double EDF_TST_A3; static double EDF_TST_F4; static double EDF_TST_A4; static double EDF_TST_F5; static double EDF_TST_A5; static double EDF_TST_F6; static double EDF_TST_A6; static double EDF_TST_F7; static double EDF_TST_A7; //---------------------------------------- // // feature file-related constants // //---------------------------------------- // PHI-related constants // static long MAX_NUM_YEARS; static long DEF_NUM_YEARS; // default values // static double DEF_FDUR; static const char* DEF_FNMOD; static const char* DEF_FFMT_NAME; // output feature file generation-related parameters // static const char* FFMT_NAME_00; static const char* FFMT_NAME_01; static const char* FFMT_NAME_02; static const char* FFMT_NAME_03; // enumerations related to output file generation // enum FFMT {FFMT_EDF = 0, FFMT_RAW, FFMT_HTK, FFMT_KALDI, DEF_FFMT = FFMT_EDF}; // HTK constants: // note that even though HTK scales fdur by 100ns, we use a // larger value here because it helps HTK work better // static double HTK_FDUR_SCALE; // normalization constant // static const char* NORM_TYPE_00; static const char* NORM_TYPE_01; static const char* NORM_TYPE_DEF; // Kaldi constants // static const long KALDI_HEADER_FIXED_SIZE = 15; static const long KALDI_VECTOR_FIXED_LOC = 11; static const long KALDI_FRAME_FIXED_LOC = 6; static const char KALDI_HEADER_EOT = 4; static const char* KALDI_HEADER_STR; //---------------------------------------- // // error codes // //---------------------------------------- static const long ERR_MATCH = -1; static const long ERR_FILE = -1; static const long ERR_FEAT = -2; static const int DEF_DBG_NS = 10; static const int DEF_DBG_NF = 30; //--------------------------------------------------------------------------- // // protected data // //--------------------------------------------------------------------------- protected: // define debug level and verbosity level // Dbgl dbgl_d; Vrbl vrbl_d; // define parameters related to standard C file processing // char* fn_d; FILE* fp_d; // define header blocksizes // // (1) contains the version of the file // char hdr_version_d[EDF_VERS_BSIZE + 1]; // (2) contains local patient information (lpti) // char hdr_lpti_patient_id_d[EDF_LPTI_TSIZE+1]; char hdr_lpti_gender_d[EDF_LPTI_TSIZE+1]; char hdr_lpti_dob_d[EDF_LPTI_TSIZE+1]; char hdr_lpti_full_name_d[EDF_LPTI_TSIZE+1]; char hdr_lpti_age_d[EDF_LPTI_TSIZE+1]; // (3) contains local recording information (lrci) // char hdr_lrci_start_date_label_d[EDF_LRCI_TSIZE+1]; char hdr_lrci_start_date_d[EDF_LRCI_TSIZE+1]; char hdr_lrci_eeg_id_d[EDF_LRCI_TSIZE+1]; char hdr_lrci_tech_d[EDF_LRCI_TSIZE+1]; char hdr_lrci_machine_d[EDF_LRCI_TSIZE+1]; // (4) contains general header information (ghdi) // char hdr_ghdi_start_date_d[EDF_LRCI_TSIZE+1]; char hdr_ghdi_start_time_d[EDF_LRCI_TSIZE+1]; long hdr_ghdi_hsize_d; char hdr_ghdi_file_type_d[EDF_LRCI_TSIZE+1]; char hdr_ghdi_reserved_d[EDF_LRCI_RSIZE+1]; long hdr_ghdi_num_recs_d; double hdr_ghdi_dur_rec_d; long hdr_ghdi_nsig_rec_d; // (5) contains channel-specific data // char* hdr_chan_labels_d[MAX_NCHANS]; char* hdr_chan_trans_types_d[MAX_NCHANS]; char* hdr_chan_phys_dim_d[MAX_NCHANS]; double hdr_chan_phys_min_d[MAX_NCHANS]; double hdr_chan_phys_max_d[MAX_NCHANS]; long hdr_chan_dig_min_d[MAX_NCHANS]; long hdr_chan_dig_max_d[MAX_NCHANS]; char* hdr_chan_prefilt_d[MAX_NCHANS]; long hdr_chan_rec_size_d[MAX_NCHANS]; // (6) define some derived values // float hdr_sample_frequency_d; long hdr_num_channels_proc_d; long hdr_num_channels_signal_d; long hdr_num_channels_annotation_d; long hdr_num_adj_channels_d; // (7) additional derived values // // label processing: // we need to store local copies of the channel selection // labels and the montage labels. these are dynamic in // that they reflect whatever the last selection or // montage requested. // MATCH_MODE smmode_d; MATCH_MODE mmmode_d; long num_slabels_d; long num_mlabels_d; long num_clabels_d; char* slabels_d[MAX_NCHANS]; char* mlabels1_d[MAX_NCHANS]; char* mlabels2_d[MAX_NCHANS]; long chan_num_d[MAX_NCHANS]; char* mchan_d[MAX_NCHANS]; // hold the number of adjacent channels related to each new channel // VectorLong num_adj_chan_d; // hold the labels of adjacent channels: // note that the labels are related o new channel i // char** adj_chan_labels_d[MAX_NCHANS]; // hold the labels to each new channel // char* new_chan_labels_d[MAX_NCHANS]; // htk-related parameters // double fdur_d; char fnmod_d[Itgl::MAX_SSTR_LENGTH]; //--------------------------------------------------------------------------- // // required public methods (edf_00) // //--------------------------------------------------------------------------- public: // method: name // static const char* name() { return CLASS_NAME; } // method: default constructor // Edf(); // method: destructor // ~Edf(); //--------------------------------------------------------------------------- // // public methods: infrastructure methods (edf_00) // //--------------------------------------------------------------------------- public: // resizing methods // bool resize(char*& str, long size, bool preserve = false); bool resize(VectorBool& v, long size, bool preserve = false); bool resize(VectorLong& v, long size, bool preserve = false); bool resize(VectorDouble& v, long size, bool preserve = false); bool resize(VVectorLong& v, long size, bool preserve = false); bool resize(VVectorDouble& v, long size, bool preserve = false); bool resize(VVVectorDouble& v, long size, bool preserve = false); bool resize(MatrixDouble& v, long size1, long size2, bool preserve = false); bool resize(VMatrixDouble& v, long nchan, bool preserve = false); // memory management methods // bool cleanup(); bool cleanup(char** strs, long num_strs); bool cleanup_labels(); // parameter file parsing and string methods // note that parse_aux parses the interpolation and montage specs // bool get_nvp(char* name, char* value, const char* buf); long find_vname(const char* name, const char** vnames); bool set_var(long pos, const char* value, char** vtypes, void** vptrs); bool parse_aux(char** strm, char** stri); //--------------------------------------------------------------------------- // // public methods: header-related methods (edf_01) // //--------------------------------------------------------------------------- public: // display methods // bool print_header(FILE* fp, const char* prefix = (char*)"\t"); bool print_header(const char* fname, FILE* fp, const char* prefix = (char*)"\t"); bool debug(VVectorDouble& sig, FILE* fp = stdout); bool debug(VVVectorDouble& feat, FILE* fp = stdout); // get header information // bool get_header(const char* fname); bool get_header(FILE* fp); long get_header_size(FILE* fp = (FILE*)NULL); // put header information // bool put_header(FILE* fp); // copy header information // bool copy_header(Edf& edf); //--------------------------------------------------------------------------- // // public methods: file I/O-related methods (edf_01) // //--------------------------------------------------------------------------- public: // get/put signal information // bool get_signal(VVectorDouble& sig, FILE* fp, const bool sc = true); bool put_signal(VVectorDouble& sig, FILE* fp, const bool sc = true); // read/write signal data (EDF files) // bool read_edf(VVectorDouble& sig, const char* fn, bool sc = true, bool rsig = true); bool write_edf(VVectorDouble& sig, const char* fn, const bool sc = true); // read feature data // bool read_features(VVVectorDouble& feat, const char* fname); bool read_features_raw(VVVectorDouble& feat, const char* fn); bool read_features_htk(VVVectorDouble& feat, const char* fn); bool read_features_kaldi(VVVectorDouble& feat, const char* fn); // write feature data // bool write_features(VVVectorDouble& feat, const char* fname, FFMT fffmt); bool write_features_raw(VVVectorDouble& feat, const char* fn); bool write_features_htk(VVVectorDouble& feat, const char* fn); bool write_features_kaldi(VVVectorDouble& feat, const char* fn); // informational methods // bool is_edf(const char* fname); bool is_filelist(const char* fname); bool is_raw(const char* fname); bool is_hea(const char* fname); bool is_htk(const char* fname); bool is_kaldi(const char* fname); // methods to deidentify data // bool deidentify(const char* subj, const char* sess, const char* tech); bool anonymize(const char* subj, const char* sess, const char* tech); //--------------------------------------------------------------------------- // // public methods: set methods (edf_02) // // These methods allows users to directly set header information. These // are often used to initialize a blank header. // //--------------------------------------------------------------------------- public: // (1) version // char* set_hdr_version(const char* str) { return strcpy(hdr_version_d, str); } // (2) local patient information (lpti) // char* set_hdr_lpti_patient_id(const char* str) { return strcpy(hdr_lpti_patient_id_d, str); } char* set_hdr_lpti_gender(const char* str) { return strcpy(hdr_lpti_gender_d, str); } char* set_hdr_lpti_dob(const char* str) { return strcpy(hdr_lpti_dob_d, str); } char* set_hdr_lpti_full_name(const char* str) { return strcpy(hdr_lpti_full_name_d, str); } char* set_hdr_lpti_age(const char* str) { return strcpy(hdr_lpti_age_d, str); } // (3) local recording information (lrci) // char* set_hdr_lrci_start_date_label(const char* str) { return strcpy(hdr_lrci_start_date_label_d, str); } char* set_hdr_lrci_start_date(const char* str) { return strcpy(hdr_lrci_start_date_d, str); } char* set_hdr_lrci_eeg_id(const char* str) { return strcpy(hdr_lrci_eeg_id_d, str); } char* set_hdr_lrci_tech(const char* str) { return strcpy(hdr_lrci_tech_d, str); } char* set_hdr_lrci_machine(const char* str) { return strcpy(hdr_lrci_machine_d, str); } // (4) general header information (ghdi) // char* set_hdr_ghdi_start_date(const char* str) { return strcpy(hdr_ghdi_start_date_d, str); } char* set_hdr_ghdi_start_time(const char* str) { return strcpy(hdr_ghdi_start_time_d, str); } long set_hdr_ghdi_hsize(long val) { return (hdr_ghdi_hsize_d = val); } char* set_hdr_ghdi_file_type(const char* str) { return strcpy(hdr_ghdi_file_type_d, str); } char* set_hdr_ghdi_reserved(const char* str) { return strcpy(hdr_ghdi_reserved_d, str); } long set_hdr_ghdi_num_recs(long val) { return (hdr_ghdi_num_recs_d = val); } double set_hdr_ghdi_dur_rec(double val) { return (hdr_ghdi_dur_rec_d = val); } long set_hdr_ghdi_nsig_rec(long val) { return (hdr_ghdi_nsig_rec_d = val); } // (5) set channel-specific data // bool set_hdr_chan_labels(char** labels, long nchans); bool set_hdr_chan_trans_types(char** ttypes, long nchans); bool set_hdr_chan_phys_dim(char** physd, long nchans); bool set_hdr_chan_phys_min(double* physm, long nchans); bool set_hdr_chan_phys_max(double* physm, long nchans); bool set_hdr_chan_dig_min(long* digm, long nchans); bool set_hdr_chan_dig_max(long* digm, long nchans); bool set_hdr_chan_prefilt(char** prefilt, long nchans); bool set_hdr_chan_rec_size(long* recsz, long nchans); // (6) set derived values // float set_sample_frequency(float hdr_sample) { return (hdr_sample_frequency_d = hdr_sample); } long set_hdr_num_channels_proc(long val) { return (hdr_num_channels_proc_d = val); } long set_hdr_num_channels_signal(long val) { return (hdr_num_channels_signal_d = val); } long set_hdr_num_channels_annotation(long val) { return (hdr_num_channels_annotation_d = val); } long set_hdr_num_adj_channels(long val) { return (hdr_num_adj_channels_d = val); } //--------------------------------------------------------------------------- // // public methods: more set methods (edf_02) // // These methods allows users to various derived parameters used by // other methods. // //--------------------------------------------------------------------------- public: // additional set methods needed for backward compatibilty // bool set_rec_size(long chan, long val) { hdr_chan_rec_size_d[chan] = val; return true; } bool set_start_time(const char* st_time); bool set_start_date(const char* st_date); bool set_record_duration(double dur); bool set_num_records(long num_recs); bool set_channel_information(char** labels, char** trans_type, char** phys_dim, double* phys_min, double* phys_max, long* dig_min, long* dig_max, char** prefilt); float set_fdur(double fdur) { return (fdur_d = fdur); } bool set_filename_modifier(const char* fnmod) { return strcpy(fnmod_d, fnmod); } bool set_montage_chans(long num_montage); bool increment_start_time(long num_seconds); //--------------------------------------------------------------------------- // // public methods: get methods (edf_03) // // These methods allows users to directly set header information. These // are often used to set a blank header. // //--------------------------------------------------------------------------- public: // (1) version // char* get_hdr_version() { return hdr_version_d; } // (2) local patient information (lpti) // char* get_hdr_lpti_patient_id() { return hdr_lpti_patient_id_d; } char* get_hdr_lpti_gender() { return hdr_lpti_gender_d; } char* get_hdr_lpti_dob() { return hdr_lpti_dob_d; } char* get_hdr_lpti_full_name() { return hdr_lpti_full_name_d; } char* get_hdr_lpti_age() { return hdr_lpti_age_d; } // (3) local recording information (lrci) // char* get_hdr_lrci_start_date_label() { return hdr_lrci_start_date_label_d; } char* get_hdr_lrci_start_date() { return hdr_lrci_start_date_d; } char* get_hdr_lrci_eeg_id() { return hdr_lrci_eeg_id_d; } char* get_hdr_lrci_tech() { return hdr_lrci_tech_d; } char* get_hdr_lrci_machine() { return hdr_lrci_machine_d; } // (4) general header information (ghdi) // char* get_hdr_ghdi_start_date() { return hdr_ghdi_start_date_d; } char* get_hdr_ghdi_start_time() { return hdr_ghdi_start_time_d; } long get_hdr_ghdi_hsize(long val) { return hdr_ghdi_hsize_d; } char* get_hdr_ghdi_file_type() { return hdr_ghdi_file_type_d; } char* get_hdr_ghdi_reserved() { return hdr_ghdi_reserved_d; } long get_hdr_ghdi_num_recs() { return hdr_ghdi_num_recs_d; } double get_hdr_ghdi_dur_rec() { return hdr_ghdi_dur_rec_d; } long get_hdr_ghdi_nsig_rec() { return hdr_ghdi_nsig_rec_d; } // (5) set channel-specific data // bool get_hdr_chan_labels(char**& labels, long& nchans); bool get_hdr_chan_trans_types(char**& ttypes, long& nchans); bool get_hdr_chan_phys_dim(char**& physd, long& nchans); bool get_hdr_chan_phys_min(double*& physm, long& nchans); bool get_hdr_chan_phys_max(double*& physm, long& nchans); bool get_hdr_chan_dig_min(long*& digm, long& nchans); bool get_hdr_chan_dig_max(long*& digm, long& nchans); bool get_hdr_chan_prefilt(char**& prefilt, long& nchans); bool get_hdr_chan_rec_size(long*& recsz, long& nchans); // (6) set derived values // float get_sample_frequency(long chan = (long)-1); long get_hdr_num_channels_proc() { return hdr_num_channels_proc_d; } long get_hdr_num_channels_signal() { return hdr_num_channels_signal_d; } long get_hdr_num_channels_annotation() { return hdr_num_channels_annotation_d; } long get_hdr_num_adj_channels() { return hdr_num_adj_channels_d; } //--------------------------------------------------------------------------- // // public methods: more get methods (edf_03) // // These methods allows users to various derived parameters used by // other methods. These are legacy methods preserved for // backward compatibility. // //--------------------------------------------------------------------------- public: // get/set for the frame duration // double get_fdur() { return fdur_d; } // get/set for the filename modifier // bool get_filename_modifier(char* fnmod) { return strcpy(fnmod, fnmod_d); } // get record information // long get_num_records() { return hdr_ghdi_num_recs_d; } long get_rec_size(long chan) {return hdr_chan_rec_size_d[chan];} double get_record_duration() {return hdr_ghdi_dur_rec_d;} // get sample and time information // long get_num_samples(long chan) { return hdr_chan_rec_size_d[chan] * hdr_ghdi_num_recs_d; } double get_duration() { return (float)(hdr_ghdi_dur_rec_d * hdr_ghdi_num_recs_d); } // get channel and label information // long get_num_channels_file() {return hdr_ghdi_nsig_rec_d;} long get_num_channels_proc() {return hdr_num_channels_proc_d;} long get_labels(char** labels); char** get_channel_labels() {return hdr_chan_labels_d;} long get_channel_pos(const char* label, MATCH_MODE matmode); // other signal information // char* get_trans_type(long i) {return hdr_chan_trans_types_d[i];} char* get_phys_dim(long i){return hdr_chan_phys_dim_d[i];} double get_phys_min(long i){return hdr_chan_phys_min_d[i];} double get_phys_max(long i){return hdr_chan_phys_max_d[i];} long get_dig_min(long i){return hdr_chan_dig_min_d[i];} long get_dig_max(long i){return hdr_chan_dig_max_d[i];} char* get_prefilt(long i){return hdr_chan_prefilt_d[i];} // get montage methods: // note these can only be called after a montage has been applied // long get_num_montage_labels() {return num_mlabels_d;} char** get_montage_labels() {return mchan_d;} // check_montage methods // bool get_montage_channels(long& nchannels, char** channels); bool check_montage(const char* missing_channels, const char* fname, long nmontage, MATCH_MODE matmode, char** montage_channels); //----------------------------------------------------- // // public methods: filename methods (edf_04) // //--------------------------------------------------------------------------- public: // filename manipulation methods // bool trans_filename(char* tdir, char* tname, const char* iname, const char* odir, const char* rdir); bool create_filename(char* oname, const char* iname, const char* odir, const char* oext, const char* odir_repl, bool cdir = true); bool create_filelist(char** onames, long nnames, const char* iname, const char* fnmod); bool create_directory(const char* path, \ mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); //--------------------------------------------------------------------------- // // public methods: channel selection and manipulation (edf_05) // //--------------------------------------------------------------------------- public: // channel selection methods // bool select_channel(VVectorDouble& sig_out, VVectorDouble& sig_in, const char* cselect); bool select(VVectorDouble& sig_out, VVectorDouble& sig_in, const char* cselect, MATCH_MODE matmode); bool remove(VVectorDouble& sig_out, VVectorDouble& sig_in, const char* cselect, MATCH_MODE matmode); bool apply_montage(VVectorDouble& sigo, VVectorDouble& sigi, char** mselect, MATCH_MODE matmode); //--------------------------------------------------------------------------- // // public methods: signal processing and interpolation methods (edf_06) // //--------------------------------------------------------------------------- public: // copy methods // bool copy_signal(VVectorDouble& sigo, VVectorDouble& sigi); bool copy_signal(VVectorDouble& sigo, long& nlo, char** labelso, VVectorDouble& sigi, long nli, char** labelsi); // interpolation methods // bool set_interp_chans(long new_channels); bool add_interp_channel(VVectorDouble& sig_out, VVectorDouble& sig_in, VVectorDouble& chan_in, INTERPOLATE_OMODE omode); bool interpolate(VVectorDouble& sig, MATCH_MODE matmode, INTERPOLATE_MODE mode, INTERPOLATE_OMODE omode); // test signal methods // bool test_signal(VVectorDouble& sig, const char* mode); //--------------------------------------------------------------------------- // // public methods: general tools (e.g., parsing, linear algebra (edf_07) // //--------------------------------------------------------------------------- public: // string processing methods // bool parse_line(long& nl, char** labels, const char* str, const char* c); // math and vector methods // bool shift(VectorDouble& v, long incr); //--------------------------------------------------------------------------- // // private methods (edf_08) // //--------------------------------------------------------------------------- private: // header manipulations and information // long compute_header_size(long num_channels); // special file I/O methods // bool read_htk_channel(VVectorDouble& feat, double& fdur, const char* fname); bool write_htk_channel(VVectorDouble& feat, double fdur, const char* fname); bool is_big_endian(); bool swap_bytes(void* buf, void* value, long nbytes); // string processing methods // bool uppercase(char* str); long find_match(const char* label, long nl, char** lbls, MATCH_MODE matmode); bool trim_whitespace(char* str_o, const char* str_i); bool trim_whitespace_and_upcase(char* str_o, const char* str_i); bool trim_last_character(char* str, const char chr); bool pad_whitespace(char* str, long len); // parsing methods // bool parse_montage(long& nl, char** labels1, char** labels2, char** chan_labels, long* num_chans, char** str); bool parse_operands(long& nl_o, char** labels1, char** labels2, long nl_i, char** labels_i); bool parse_interp_channels(long& nl_i, char*** labels1, VectorLong& num_chans, char** newChannel, char** str); // filename processing methods // bool get_matching_filenames(char** fnames, long& nf, const char* bfn, const char* fmt); bool create_matching_filename(char* dirname, char* bname, char* ext, char* fname, long nf, const char* bfn, const char* fmt); // interpolation methods // bool interpolate_average(VVectorDouble& new_chan, VVectorDouble& sig); // // end of class }; // end of include file // #endif