Loading EEG/EEG.cpp +44 −2 Original line number Diff line number Diff line Loading @@ -591,6 +591,48 @@ autoEEG EEG_extractChannels (EEG me, numvec channelNumbers) { } } static void Sound_removeChannel (Sound me, integer channelNumber) { try { Melder_require (channelNumber >= 1 && channelNumber <= my ny, U"No channel ", channelNumber, U"."); Melder_require (my ny > 1, U"Cannot remove last remaining channel."); for (integer ichan = channelNumber; ichan < my ny; ichan ++) { NUMvector_copyElements (my z [ichan + 1], my z [ichan], 1, my nx); } my ymax -= 1.0; my ny -= 1; } catch (MelderError) { Melder_throw (me, U": channel ", channelNumber, U" not removed."); } } void EEG_removeChannel (EEG me, integer channelNumber) { try { if (channelNumber < 1 || channelNumber > my numberOfChannels) Melder_throw (U"No channel ", channelNumber, U"."); Melder_free (my channelNames [channelNumber]); for (integer ichan = channelNumber; ichan < my numberOfChannels; ichan ++) { my channelNames [ichan] = my channelNames [ichan + 1]; } my numberOfChannels -= 1; Sound_removeChannel (my sound.get(), channelNumber); } catch (MelderError) { Melder_throw (me, U": channel ", channelNumber, U" not removed."); } } void EEG_removeChannel (EEG me, const char32 *channelName) { try { integer channelNumber = EEG_getChannelNumber (me, channelName); if (channelNumber == 0) Melder_throw (U"No channel named \"", channelName, U"\"."); EEG_removeChannel (me, channelNumber); } catch (MelderError) { Melder_throw (me, U": channel ", channelName, U" not removed."); } } autoEEG EEGs_concatenate (OrderedOf<structEEG>* me) { try { if (my size < 1) Loading EEG/EEG.h +2 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,8 @@ void EEG_removeTriggers (EEG me, kMelder_string which, const char32 *criterion); autoEEG EEG_extractChannel (EEG me, integer channelNumber); autoEEG EEG_extractChannel (EEG me, const char32 *channelName); autoEEG EEG_extractChannels (EEG me, numvec channelNumbers); void EEG_removeChannel (EEG me, integer channelNumber); void EEG_removeChannel (EEG me, const char32 *channelName); static inline autoSound EEG_extractSound (EEG me) { return Data_copy (my sound.get()); } static inline autoTextGrid EEG_extractTextGrid (EEG me) { return Data_copy (my textgrid.get()); } autoEEG EEG_extractPart (EEG me, double tmin, double tmax, bool preserveTimes); Loading EEG/ERPTier.cpp +2 −2 Original line number Diff line number Diff line /* ERPTier.cpp * * Copyright (C) 2011-2012,2014,2015,2016,2017 Paul Boersma * Copyright (C) 2011-2012,2014-2018 Paul Boersma * * This code is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Loading Loading @@ -344,7 +344,7 @@ autoERPTier ERPTier_extractEventsWhereColumn_string (ERPTier me, Table table, for (integer ievent = 1; ievent <= my points.size; ievent ++) { ERPPoint oldEvent = my points.at [ievent]; TableRow row = table -> rows.at [ievent]; if (Melder_stringMatchesCriterion (row -> cells [columnNumber]. string, which, criterion)) { if (Melder_stringMatchesCriterion (row -> cells [columnNumber]. string, which, criterion, true)) { autoERPPoint newEvent = Data_copy (oldEvent); thy points. addItem_move (newEvent.move()); } Loading EEG/ERPWindow.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -202,7 +202,7 @@ void ERP_drawScalp (ERP me, Graphics graphics, double tmin, double tmax, double double x = -1.0 + (icol - 1) * d; if (x * x + y * y <= 1.0) { double value = undefined; real80 sum = 0.0, weight = 0.0; longdouble sum = 0.0, weight = 0.0; for (integer ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) { double dx = x - biosemiLocationData [ichan]. topX; double dy = y - biosemiLocationData [ichan]. topY; Loading @@ -216,7 +216,7 @@ void ERP_drawScalp (ERP me, Graphics graphics, double tmin, double tmax, double weight += 1.0 / distance; } if (isundef (value)) value = ( sum == 0.0 ? 0.0 : real (sum / weight) ); value = ( sum == 0.0 ? 0.0 : double (sum / weight) ); image [irow] [icol] = value; } } Loading Loading @@ -306,7 +306,7 @@ void structERPWindow :: v_drawSelectionViewer () { double x = -1.0 + (icol - 1) * d; if (x * x + y * y <= 1.0) { double value = undefined; real80 sum = 0.0, weight = 0.0; longdouble sum = 0.0, weight = 0.0; for (integer ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) { double dx = x - biosemiLocationData [ichan]. topX; double dy = y - biosemiLocationData [ichan]. topY; Loading @@ -320,7 +320,7 @@ void structERPWindow :: v_drawSelectionViewer () { weight += 1.0 / distance; } if (isundef (value)) value = ( sum == 0.0 ? 0.0 : real (sum / weight) ); value = ( sum == 0.0 ? 0.0 : double (sum / weight) ); image [irow] [icol] = value; } } Loading EEG/manual_EEG.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ ENTRY (U"See also") LIST_ITEM (U"\\bu @@Independent Component Analysis on EEG@") MAN_END MAN_BEGIN (U"Independent Component Analysis on EEG", U"ppgb", 20180329) MAN_BEGIN (U"Independent Component Analysis on EEG", U"ppgb", 20180502) INTRO (U"Independent Component Analysis (ICA) is often used to improve @EEG signals. " "See @@blind source separation@ for the algorithm.") ENTRY (U"1. Selecting your channels") Loading @@ -102,10 +102,10 @@ NORMAL (U"Once you have your reduced EEG, you can start to do ICA on it. " "This starts by creating a @MixingMatrix: select your EEG object and choose ##To MixingMatrix...#. " "The resulting MixingMatrix has one row for each of your 64 EEG channels, and columns called \"ic1\" through \"ic64\".") ENTRY (U"3. How to see the independent components") NORMAL (U"Select you EEG and your MixingMatrix together and choose ##Unmix#. " NORMAL (U"Select your EEG and your MixingMatrix together and choose ##Unmix#. " "The resulting ICA-EEG will have 64 channels called \"ic1\" through \"ic64\".") ENTRY (U"4. Just checking back") NORMAL (U"If you select your ICA-EEG together with your MixingMatrix choose ##Mix#, " NORMAL (U"If you select your ICA-EEG together with your MixingMatrix and choose ##Mix#, " "the resulting EEG should be very similar to your original 64-channel EEG.") MAN_END Loading Loading
EEG/EEG.cpp +44 −2 Original line number Diff line number Diff line Loading @@ -591,6 +591,48 @@ autoEEG EEG_extractChannels (EEG me, numvec channelNumbers) { } } static void Sound_removeChannel (Sound me, integer channelNumber) { try { Melder_require (channelNumber >= 1 && channelNumber <= my ny, U"No channel ", channelNumber, U"."); Melder_require (my ny > 1, U"Cannot remove last remaining channel."); for (integer ichan = channelNumber; ichan < my ny; ichan ++) { NUMvector_copyElements (my z [ichan + 1], my z [ichan], 1, my nx); } my ymax -= 1.0; my ny -= 1; } catch (MelderError) { Melder_throw (me, U": channel ", channelNumber, U" not removed."); } } void EEG_removeChannel (EEG me, integer channelNumber) { try { if (channelNumber < 1 || channelNumber > my numberOfChannels) Melder_throw (U"No channel ", channelNumber, U"."); Melder_free (my channelNames [channelNumber]); for (integer ichan = channelNumber; ichan < my numberOfChannels; ichan ++) { my channelNames [ichan] = my channelNames [ichan + 1]; } my numberOfChannels -= 1; Sound_removeChannel (my sound.get(), channelNumber); } catch (MelderError) { Melder_throw (me, U": channel ", channelNumber, U" not removed."); } } void EEG_removeChannel (EEG me, const char32 *channelName) { try { integer channelNumber = EEG_getChannelNumber (me, channelName); if (channelNumber == 0) Melder_throw (U"No channel named \"", channelName, U"\"."); EEG_removeChannel (me, channelNumber); } catch (MelderError) { Melder_throw (me, U": channel ", channelName, U" not removed."); } } autoEEG EEGs_concatenate (OrderedOf<structEEG>* me) { try { if (my size < 1) Loading
EEG/EEG.h +2 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,8 @@ void EEG_removeTriggers (EEG me, kMelder_string which, const char32 *criterion); autoEEG EEG_extractChannel (EEG me, integer channelNumber); autoEEG EEG_extractChannel (EEG me, const char32 *channelName); autoEEG EEG_extractChannels (EEG me, numvec channelNumbers); void EEG_removeChannel (EEG me, integer channelNumber); void EEG_removeChannel (EEG me, const char32 *channelName); static inline autoSound EEG_extractSound (EEG me) { return Data_copy (my sound.get()); } static inline autoTextGrid EEG_extractTextGrid (EEG me) { return Data_copy (my textgrid.get()); } autoEEG EEG_extractPart (EEG me, double tmin, double tmax, bool preserveTimes); Loading
EEG/ERPTier.cpp +2 −2 Original line number Diff line number Diff line /* ERPTier.cpp * * Copyright (C) 2011-2012,2014,2015,2016,2017 Paul Boersma * Copyright (C) 2011-2012,2014-2018 Paul Boersma * * This code is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Loading Loading @@ -344,7 +344,7 @@ autoERPTier ERPTier_extractEventsWhereColumn_string (ERPTier me, Table table, for (integer ievent = 1; ievent <= my points.size; ievent ++) { ERPPoint oldEvent = my points.at [ievent]; TableRow row = table -> rows.at [ievent]; if (Melder_stringMatchesCriterion (row -> cells [columnNumber]. string, which, criterion)) { if (Melder_stringMatchesCriterion (row -> cells [columnNumber]. string, which, criterion, true)) { autoERPPoint newEvent = Data_copy (oldEvent); thy points. addItem_move (newEvent.move()); } Loading
EEG/ERPWindow.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -202,7 +202,7 @@ void ERP_drawScalp (ERP me, Graphics graphics, double tmin, double tmax, double double x = -1.0 + (icol - 1) * d; if (x * x + y * y <= 1.0) { double value = undefined; real80 sum = 0.0, weight = 0.0; longdouble sum = 0.0, weight = 0.0; for (integer ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) { double dx = x - biosemiLocationData [ichan]. topX; double dy = y - biosemiLocationData [ichan]. topY; Loading @@ -216,7 +216,7 @@ void ERP_drawScalp (ERP me, Graphics graphics, double tmin, double tmax, double weight += 1.0 / distance; } if (isundef (value)) value = ( sum == 0.0 ? 0.0 : real (sum / weight) ); value = ( sum == 0.0 ? 0.0 : double (sum / weight) ); image [irow] [icol] = value; } } Loading Loading @@ -306,7 +306,7 @@ void structERPWindow :: v_drawSelectionViewer () { double x = -1.0 + (icol - 1) * d; if (x * x + y * y <= 1.0) { double value = undefined; real80 sum = 0.0, weight = 0.0; longdouble sum = 0.0, weight = 0.0; for (integer ichan = 1; ichan <= numberOfDrawableChannels; ichan ++) { double dx = x - biosemiLocationData [ichan]. topX; double dy = y - biosemiLocationData [ichan]. topY; Loading @@ -320,7 +320,7 @@ void structERPWindow :: v_drawSelectionViewer () { weight += 1.0 / distance; } if (isundef (value)) value = ( sum == 0.0 ? 0.0 : real (sum / weight) ); value = ( sum == 0.0 ? 0.0 : double (sum / weight) ); image [irow] [icol] = value; } } Loading
EEG/manual_EEG.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ ENTRY (U"See also") LIST_ITEM (U"\\bu @@Independent Component Analysis on EEG@") MAN_END MAN_BEGIN (U"Independent Component Analysis on EEG", U"ppgb", 20180329) MAN_BEGIN (U"Independent Component Analysis on EEG", U"ppgb", 20180502) INTRO (U"Independent Component Analysis (ICA) is often used to improve @EEG signals. " "See @@blind source separation@ for the algorithm.") ENTRY (U"1. Selecting your channels") Loading @@ -102,10 +102,10 @@ NORMAL (U"Once you have your reduced EEG, you can start to do ICA on it. " "This starts by creating a @MixingMatrix: select your EEG object and choose ##To MixingMatrix...#. " "The resulting MixingMatrix has one row for each of your 64 EEG channels, and columns called \"ic1\" through \"ic64\".") ENTRY (U"3. How to see the independent components") NORMAL (U"Select you EEG and your MixingMatrix together and choose ##Unmix#. " NORMAL (U"Select your EEG and your MixingMatrix together and choose ##Unmix#. " "The resulting ICA-EEG will have 64 channels called \"ic1\" through \"ic64\".") ENTRY (U"4. Just checking back") NORMAL (U"If you select your ICA-EEG together with your MixingMatrix choose ##Mix#, " NORMAL (U"If you select your ICA-EEG together with your MixingMatrix and choose ##Mix#, " "the resulting EEG should be very similar to your original 64-channel EEG.") MAN_END Loading