[med-svn] [aghermann] 15/60: WIP (EMG-perturbation-based AD in Simple Artifact Detection dialog, and then some)

andrei zavada hmmr-guest at alioth.debian.org
Mon Nov 4 23:49:53 UTC 2013


This is an automated email from the git hooks/post-receive script.

hmmr-guest pushed a commit to branch WIP
in repository aghermann.

commit 6959a6c38daccd3f5ef299cc379a8d74c920428d
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Fri Oct 11 01:47:14 2013 +0300

    WIP (EMG-perturbation-based AD in Simple Artifact Detection dialog, and then some)
---
 upstream/data/sf-artifacts-simple.glade            |  229 +++++++++++++++++---
 upstream/data/sf.glade                             |    5 +-
 upstream/src/aghermann/ui/sf/channel.cc            |   22 +-
 upstream/src/aghermann/ui/sf/channel.hh            |   20 +-
 upstream/src/aghermann/ui/sf/construct.cc          |    4 +-
 .../ui/sf/d/artifacts-simple-construct.cc          |    4 +
 upstream/src/aghermann/ui/sf/d/artifacts-simple.cc |   17 +-
 upstream/src/aghermann/ui/sf/d/artifacts-simple.hh |   22 +-
 upstream/src/aghermann/ui/sf/montage-menus_cb.cc   |   22 +-
 upstream/src/aghermann/ui/sf/sf_cb.hh              |    2 +-
 upstream/src/aghermann/ui/sf/widgets.hh            |    2 +-
 11 files changed, 288 insertions(+), 61 deletions(-)

diff --git a/upstream/data/sf-artifacts-simple.glade b/upstream/data/sf-artifacts-simple.glade
index 2756600..7b5d1bf 100644
--- a/upstream/data/sf-artifacts-simple.glade
+++ b/upstream/data/sf-artifacts-simple.glade
@@ -8,6 +8,20 @@
     <property name="step_increment">0.01</property>
     <property name="page_increment">0.10000000000000001</property>
   </object>
+  <object class="GtkAdjustment" id="jSFASMinSteadyToneFactor">
+    <property name="lower">1</property>
+    <property name="upper">20</property>
+    <property name="value">1.1000000000000001</property>
+    <property name="step_increment">0.10000000000000001</property>
+    <property name="page_increment">0.5</property>
+  </object>
+  <object class="GtkAdjustment" id="jSFASMinSteadyToneRun">
+    <property name="lower">1</property>
+    <property name="upper">9999</property>
+    <property name="value">1</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">5</property>
+  </object>
   <object class="GtkAdjustment" id="jSFASPad">
     <property name="upper">10</property>
     <property name="value">0.20000000000000001</property>
@@ -35,6 +49,7 @@
           <object class="GtkButtonBox" id="dialog-action_area14">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="margin_top">10</property>
             <property name="layout_style">end</property>
             <child>
               <object class="GtkButton" id="bFilterCancel1">
@@ -79,7 +94,7 @@
           <object class="GtkTable" id="table4">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="n_rows">6</property>
+            <property name="n_rows">11</property>
             <property name="n_columns">3</property>
             <property name="row_spacing">10</property>
             <child>
@@ -93,8 +108,8 @@
               <packing>
                 <property name="left_attach">2</property>
                 <property name="right_attach">3</property>
-                <property name="top_attach">3</property>
-                <property name="bottom_attach">4</property>
+                <property name="top_attach">4</property>
+                <property name="bottom_attach">5</property>
                 <property name="x_options">GTK_FILL</property>
                 <property name="y_options">GTK_FILL</property>
               </packing>
@@ -110,8 +125,8 @@
               <packing>
                 <property name="left_attach">2</property>
                 <property name="right_attach">3</property>
-                <property name="top_attach">2</property>
-                <property name="bottom_attach">3</property>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
                 <property name="x_options">GTK_FILL</property>
                 <property name="y_options">GTK_FILL</property>
               </packing>
@@ -131,99 +146,247 @@
               </packing>
             </child>
             <child>
-              <object class="GtkSeparator" id="separator1">
+              <object class="GtkSpinButton" id="eSFASMinFlatRegionSize">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">•</property>
+                <property name="xalign">1</property>
+                <property name="invisible_char_set">True</property>
+                <property name="adjustment">jSFASMinFlatRegionSize</property>
+                <property name="digits">2</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label47">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="margin_right">5</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">Minimal flat region size:</property>
+                <property name="use_underline">True</property>
               </object>
               <packing>
-                <property name="right_attach">3</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
               </packing>
             </child>
             <child>
-              <object class="GtkSeparator" id="separator13">
+              <object class="GtkLabel" id="label48">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="margin_top">5</property>
-                <property name="margin_bottom">5</property>
+                <property name="margin_right">5</property>
+                <property name="xalign">1</property>
+                <property name="label" translatable="yes">Pad:</property>
+                <property name="use_underline">True</property>
               </object>
               <packing>
-                <property name="right_attach">3</property>
                 <property name="top_attach">4</property>
                 <property name="bottom_attach">5</property>
               </packing>
             </child>
             <child>
-              <object class="GtkSpinButton" id="eSFASMinFlatRegionSize">
+              <object class="GtkSpinButton" id="eSFASPad">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="invisible_char">•</property>
                 <property name="xalign">1</property>
                 <property name="invisible_char_set">True</property>
-                <property name="adjustment">jSFASMinFlatRegionSize</property>
+                <property name="adjustment">jSFASPad</property>
                 <property name="digits">2</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
                 <property name="right_attach">2</property>
+                <property name="top_attach">4</property>
+                <property name="bottom_attach">5</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label14">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="valign">end</property>
+                <property name="margin_top">5</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Flat signal</property>
+                <attributes>
+                  <attribute name="style" value="italic"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="right_attach">3</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSeparator" id="separator1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="right_attach">3</property>
                 <property name="top_attach">2</property>
                 <property name="bottom_attach">3</property>
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="label47">
+              <object class="GtkLabel" id="label1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="margin_right">5</property>
+                <property name="valign">end</property>
+                <property name="margin_top">5</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Perturbations in EMG</property>
+                <attributes>
+                  <attribute name="style" value="italic"/>
+                </attributes>
+              </object>
+              <packing>
+                <property name="right_attach">3</property>
+                <property name="top_attach">5</property>
+                <property name="bottom_attach">6</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSeparator" id="separator13">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="right_attach">3</property>
+                <property name="top_attach">6</property>
+                <property name="bottom_attach">7</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="eSFASLookAtEMG">
+                <property name="label" translatable="yes">Mark artifacts where EMG is </property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="halign">end</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">7</property>
+                <property name="bottom_attach">8</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkSpinButton" id="eSFASMinSteadyToneFactor">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">•</property>
                 <property name="xalign">1</property>
-                <property name="label" translatable="yes">Minimal flat region size:</property>
-                <property name="use_underline">True</property>
+                <property name="adjustment">jSFASMinSteadyToneFactor</property>
+                <property name="digits">2</property>
+                <property name="numeric">True</property>
               </object>
               <packing>
-                <property name="top_attach">2</property>
-                <property name="bottom_attach">3</property>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">7</property>
+                <property name="bottom_attach">8</property>
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="label48">
+              <object class="GtkLabel" id="label2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">5</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">times steady tone</property>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="right_attach">3</property>
+                <property name="top_attach">7</property>
+                <property name="bottom_attach">8</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label3">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="margin_right">5</property>
                 <property name="xalign">1</property>
-                <property name="label" translatable="yes">Pad:</property>
+                <property name="label" translatable="yes">seen for at least</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
-                <property name="top_attach">3</property>
-                <property name="bottom_attach">4</property>
+                <property name="top_attach">8</property>
+                <property name="bottom_attach">9</property>
               </packing>
             </child>
             <child>
-              <object class="GtkSpinButton" id="eSFASPad">
+              <object class="GtkSpinButton" id="eSFASMinSteadyToneRun">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="invisible_char">•</property>
                 <property name="xalign">1</property>
                 <property name="invisible_char_set">True</property>
-                <property name="adjustment">jSFASPad</property>
-                <property name="digits">2</property>
+                <property name="adjustment">jSFASMinSteadyToneRun</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
                 <property name="right_attach">2</property>
-                <property name="top_attach">3</property>
-                <property name="bottom_attach">4</property>
+                <property name="top_attach">8</property>
+                <property name="bottom_attach">9</property>
               </packing>
             </child>
             <child>
-              <placeholder/>
+              <object class="GtkLabel" id="label4">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">5</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">sec</property>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="right_attach">3</property>
+                <property name="top_attach">8</property>
+                <property name="bottom_attach">9</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
             </child>
             <child>
-              <placeholder/>
+              <object class="GtkSeparator" id="separator2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="right_attach">3</property>
+                <property name="top_attach">9</property>
+                <property name="bottom_attach">10</property>
+              </packing>
             </child>
             <child>
-              <placeholder/>
+              <object class="GtkCheckButton" id="eSFASThisChannelOnly">
+                <property name="label" translatable="yes">Apply to this channel only</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="halign">start</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="right_attach">3</property>
+                <property name="top_attach">10</property>
+                <property name="bottom_attach">11</property>
+              </packing>
             </child>
           </object>
           <packing>
diff --git a/upstream/data/sf.glade b/upstream/data/sf.glade
index 94ba205..ad640db 100644
--- a/upstream/data/sf.glade
+++ b/upstream/data/sf.glade
@@ -342,10 +342,11 @@
               </object>
             </child>
             <child>
-              <object class="GtkMenuItem" id="iSFPageArtifactsMarkFlat">
+              <object class="GtkMenuItem" id="iSFPageSimpleArtifacts">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">_Mark flat regions...</property>
+                <property name="tooltip_markup" translatable="yes">Mark artifacts where signal is flat or EMG levels are high</property>
+                <property name="label" translatable="yes">_Simple artifact detection...</property>
                 <property name="use_underline">True</property>
               </object>
             </child>
diff --git a/upstream/src/aghermann/ui/sf/channel.cc b/upstream/src/aghermann/ui/sf/channel.cc
index 479d9ec..08e262a 100644
--- a/upstream/src/aghermann/ui/sf/channel.cc
+++ b/upstream/src/aghermann/ui/sf/channel.cc
@@ -39,6 +39,7 @@ SChannel (agh::CRecording& r,
           size_t y0,
           int seq)
       : crecording (r),
+        schannel (crecording.F().channel_by_id( crecording.h())),
         filters (r.F().filters(h())),
         annotations (r.F().annotations(h())),
         artifacts (r.F().artifacts(r.h())),
@@ -433,7 +434,7 @@ mark_flat_regions_as_artifacts( const double minsize, const double pad)
         size_t  marked_here = 0;
         auto d =
                 sigproc::derivative( signal_original);
-        size_t        last_j = 0;
+        size_t  last_j = 0;
         for ( size_t i = 0; i < d.size(); ++i )
                 if ( d[i] == 0. ) {
                         size_t j = i;
@@ -468,6 +469,23 @@ mark_flat_regions_as_artifacts( const double minsize, const double pad)
                  (double)(artifacts.total() - total_before) };
 }
 
+pair<double, double>
+SScoringFacility::SChannel::
+mark_emg_perturbations_as_artifacts( const double min_steadytone_factor, const double min_steadytone_run)
+{
+        // which EMG channels are there?
+        forward_list<SChannel*> HH;
+        for ( auto &H : channels )
+                if ( H.schannel.type() == sigfile::SChannel::TType::emg )
+                        HH.push_front( &H);
+        if ( HH.empty() )
+                return -1;
+        
+
+        return { (double)marked_here/samplerate(),
+                 (double)(artifacts.total() - total_before) };
+}
+
 
 
 
@@ -488,7 +506,7 @@ mark_region_as_artifact( const bool do_mark)
 
         get_signal_filtered();
 
-        if ( schannel().type() == sigfile::SChannel::TType::eeg ) {
+        if ( schannel.type() == sigfile::SChannel::TType::eeg ) {
                 get_psd_course();
                 get_psd_in_bands();
                 get_spectrum( _p.cur_page());
diff --git a/upstream/src/aghermann/ui/sf/channel.hh b/upstream/src/aghermann/ui/sf/channel.hh
index 3a65200..2f3521f 100644
--- a/upstream/src/aghermann/ui/sf/channel.hh
+++ b/upstream/src/aghermann/ui/sf/channel.hh
@@ -48,20 +48,21 @@ struct SScoringFacility::SChannel {
         bool operator==( const string&) const;
         bool operator==( const SChannel&) const;
 
+      // references to CExpDesign objects we represent
         agh::CRecording&
                 crecording;
+        sigfile::SChannel&
+                schannel;
 
         // shortcuts
         int
         h() const
                 { return crecording.h(); }
-        const sigfile::SChannel&
-        schannel() const
-                { return crecording.F().channel_by_id( h()); }
         const char*
         name() const
-                { return schannel().name(); }
+                { return schannel.name(); }
 
+      // contents
         sigfile::SFilterPack&
                 filters;
         list<sigfile::SAnnotation>&
@@ -89,11 +90,18 @@ struct SScoringFacility::SChannel {
 
       // artifacts
         float percent_dirty;
-        float calculate_dirty_percent();
-        void detect_artifacts( const metrics::mc::SArtifactDetectionPPack&);
+        float
+        calculate_dirty_percent();
+
+        void
+        detect_artifacts( const metrics::mc::SArtifactDetectionPPack&);
+
         pair<double, double>
         mark_flat_regions_as_artifacts( double at_least_this_long, double pad);
 
+        pair<double, double>
+        mark_emg_perturbations_as_artifacts( double min_steadytone_factor, double min_steadytone_run);
+
       // annotations
         list<sigfile::SAnnotation*>
         in_annotations( double time) const;
diff --git a/upstream/src/aghermann/ui/sf/construct.cc b/upstream/src/aghermann/ui/sf/construct.cc
index fcc254c..a871572 100644
--- a/upstream/src/aghermann/ui/sf/construct.cc
+++ b/upstream/src/aghermann/ui/sf/construct.cc
@@ -238,7 +238,7 @@ SScoringFacilityWidgets ()
         AGH_GBGETOBJ (iSFPageUseThisScale);
         AGH_GBGETOBJ (iSFPageArtifactsDetect);
         AGH_GBGETOBJ (iSFPageArtifactsClear);
-        AGH_GBGETOBJ (iSFPageArtifactsMarkFlat);
+        AGH_GBGETOBJ (iSFPageSimpleArtifacts);
         AGH_GBGETOBJ (iSFPageHide);
         AGH_GBGETOBJ (iSFPageHidden);
         AGH_GBGETOBJ (iSFPageSpaceEvenly);
@@ -295,7 +295,7 @@ SScoringFacilityWidgets ()
         G_CONNECT_1 (iSFPageExportSignal, activate);
         G_CONNECT_1 (iSFPageUseThisScale, activate);
         G_CONNECT_1 (iSFPageArtifactsDetect, activate);
-        G_CONNECT_1 (iSFPageArtifactsMarkFlat, activate);
+        G_CONNECT_1 (iSFPageSimpleArtifacts, activate);
         G_CONNECT_1 (iSFPageArtifactsClear, activate);
         G_CONNECT_1 (iSFPageHide, activate);
 
diff --git a/upstream/src/aghermann/ui/sf/d/artifacts-simple-construct.cc b/upstream/src/aghermann/ui/sf/d/artifacts-simple-construct.cc
index b8a151a..77bdc28 100644
--- a/upstream/src/aghermann/ui/sf/d/artifacts-simple-construct.cc
+++ b/upstream/src/aghermann/ui/sf/d/artifacts-simple-construct.cc
@@ -29,6 +29,10 @@ SArtifactsSimpleDialogWidgets ()
         AGH_GBGETOBJ (wSFAS);
         AGH_GBGETOBJ (eSFASMinFlatRegionSize);
         AGH_GBGETOBJ (eSFASPad);
+        AGH_GBGETOBJ (eSFASLookAtEMG);
+        AGH_GBGETOBJ (eSFASMinSteadyToneFactor);
+        AGH_GBGETOBJ (eSFASMinSteadyToneRun);
+        AGH_GBGETOBJ (eSFASThisChannelOnly);
 }
 
 
diff --git a/upstream/src/aghermann/ui/sf/d/artifacts-simple.cc b/upstream/src/aghermann/ui/sf/d/artifacts-simple.cc
index 85229ad..42577b1 100644
--- a/upstream/src/aghermann/ui/sf/d/artifacts-simple.cc
+++ b/upstream/src/aghermann/ui/sf/d/artifacts-simple.cc
@@ -26,12 +26,21 @@ artifacts_simple_d()
 
 SScoringFacility::SArtifactsSimpleDialog::
 SArtifactsSimpleDialog (SScoringFacility& p_)
-      : min_size (0.5),
-        pad (),
+      : flat_min_size (0.5),
+        flat_pad (.2),
+        do_emg_perturbations_check (true),
+        emg_min_steadytone_factor (1.5),
+        emg_min_steadytone_run (2.),
         _p (p_)
 {
-        W_V.reg( eSFASMinFlatRegionSize, &min_size);
-        W_V.reg( eSFASPad,               &pad);
+        W_V.reg( eSFASMinFlatRegionSize,   &flat_min_size);
+        W_V.reg( eSFASPad,                 &flat_pad);
+        W_V.reg( eSFASLookAtEMG,           &do_emg_perturbations_check);
+        W_V.reg( eSFASMinSteadyToneFactor, &emg_min_steadytone_factor);
+        W_V.reg( eSFASMinSteadyToneRun,    &emg_min_steadytone_run);
+        W_V.reg( eSFASThisChannelOnly,     &this_channel_only);
+
+        W_V.up();
 }
 
 
diff --git a/upstream/src/aghermann/ui/sf/d/artifacts-simple.hh b/upstream/src/aghermann/ui/sf/d/artifacts-simple.hh
index 7642ae6..1ec0a03 100644
--- a/upstream/src/aghermann/ui/sf/d/artifacts-simple.hh
+++ b/upstream/src/aghermann/ui/sf/d/artifacts-simple.hh
@@ -31,13 +31,23 @@ struct SArtifactsSimpleDialogWidgets {
         SArtifactsSimpleDialogWidgets ();
        ~SArtifactsSimpleDialogWidgets ();
 
-        GtkBuilder *builder;
+        GtkBuilder
+                *builder;
 
         GtkDialog
                 *wSFAS;
         GtkSpinButton
                 *eSFASMinFlatRegionSize,
                 *eSFASPad;
+
+        GtkCheckButton
+                *eSFASLookAtEMG;
+        GtkSpinButton
+                *eSFASMinSteadyToneFactor,
+                *eSFASMinSteadyToneRun;
+
+        GtkCheckButton
+                *eSFASThisChannelOnly;
 };
 
 struct SScoringFacility::SArtifactsSimpleDialog
@@ -47,8 +57,14 @@ struct SScoringFacility::SArtifactsSimpleDialog
 
         SArtifactsSimpleDialog (SScoringFacility&);
 
-        double  min_size,
-                pad;
+        double  flat_min_size,
+                flat_pad;
+
+        bool    do_emg_perturbations_check;
+        double  emg_min_steadytone_factor,
+                emg_min_steadytone_run;
+
+        bool    this_channel_only;
 
         SUIVarCollection
                 W_V;
diff --git a/upstream/src/aghermann/ui/sf/montage-menus_cb.cc b/upstream/src/aghermann/ui/sf/montage-menus_cb.cc
index 887d2e3..14c0c6b 100644
--- a/upstream/src/aghermann/ui/sf/montage-menus_cb.cc
+++ b/upstream/src/aghermann/ui/sf/montage-menus_cb.cc
@@ -321,7 +321,7 @@ iSFPageArtifactsDetect_activate_cb(
 }
 
 void
-iSFPageArtifactsMarkFlat_activate_cb(
+iSFPageSimpleArtifacts_activate_cb(
         GtkMenuItem*,
         const gpointer userdata)
 {
@@ -331,12 +331,20 @@ iSFPageArtifactsMarkFlat_activate_cb(
              gtk_dialog_run( (GtkDialog*)AS.wSFAS) ) {
                 AS.W_V.down();
 
-                auto marked = SF.using_channel->mark_flat_regions_as_artifacts( AS.min_size, AS.pad);
-
-                SF.sb_message(
-                        snprintf_buf(
-                                "Detected %.2g sec of flat regions, adding %.2g sec to already marked",
-                                marked.first, marked.second));
+                if ( AS.this_channel_only ) {
+                        auto marked_flat = SF.using_channel->mark_flat_regions_as_artifacts( AS.flat_min_size, AS.flat_pad);
+                        if ( AS.do_emg_perturbations_check )
+                                SF.using_channel->mark_emg_perturbations_as_artifacts( AS.emg_min_steadytone_factor, AS.emg_min_steadytone_run);
+                        // SF.sb_message(
+                        //         snprintf_buf(
+                        //                 "Detected %.2g sec of flat regions and %.2g sec of EMG perturbations",
+                        //                 marked_flat.first, marked_flat.second));
+                } else
+                        for ( auto& H : SF.channels ) {
+                                H.mark_flat_regions_as_artifacts( AS.flat_min_size, AS.flat_pad);
+                                if ( AS.do_emg_perturbations_check )
+                                        H.mark_emg_perturbations_as_artifacts( AS.emg_min_steadytone_factor, AS.emg_min_steadytone_run);
+                        }
 
                 gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
                 gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
diff --git a/upstream/src/aghermann/ui/sf/sf_cb.hh b/upstream/src/aghermann/ui/sf/sf_cb.hh
index e8ad8f3..259846a 100644
--- a/upstream/src/aghermann/ui/sf/sf_cb.hh
+++ b/upstream/src/aghermann/ui/sf/sf_cb.hh
@@ -92,7 +92,7 @@ void iSFPageUseResample_toggled_cb( GtkCheckMenuItem*, gpointer);
 void iSFPageDrawZeroline_toggled_cb( GtkCheckMenuItem*, gpointer);
 void iSFPageDrawEMGSteadyTone_toggled_cb( GtkCheckMenuItem*, gpointer);
 void iSFPageArtifactsDetect_activate_cb( GtkMenuItem*, gpointer);
-void iSFPageArtifactsMarkFlat_activate_cb( GtkMenuItem*, gpointer);
+void iSFPageSimpleArtifacts_activate_cb( GtkMenuItem*, gpointer);
 void iSFPageArtifactsClear_activate_cb( GtkMenuItem*, gpointer);
 void iSFPageFilter_activate_cb( GtkMenuItem*, gpointer);
 void iSFPageSaveChannelAsSVG_activate_cb( GtkMenuItem*, gpointer);
diff --git a/upstream/src/aghermann/ui/sf/widgets.hh b/upstream/src/aghermann/ui/sf/widgets.hh
index 35d64bd..d369bd0 100644
--- a/upstream/src/aghermann/ui/sf/widgets.hh
+++ b/upstream/src/aghermann/ui/sf/widgets.hh
@@ -165,7 +165,7 @@ struct SScoringFacilityWidgets {
                 *iSFPageFilter,
                 *iSFPageSaveChannelAsSVG, *iSFPageSaveMontageAsSVG,
                 *iSFPageExportSignal, *iSFPageUseThisScale,
-                *iSFPageArtifactsDetect, *iSFPageArtifactsMarkFlat, *iSFPageArtifactsClear,
+                *iSFPageArtifactsDetect, *iSFPageSimpleArtifacts, *iSFPageArtifactsClear,
                 *iSFPageHide,
                 *iSFPageHidden,  // has a submenu
                 *iSFPageSpaceEvenly,

-- 
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git



More information about the debian-med-commit mailing list