[med-svn] [aghermann] 13/60: SF: draw EMG steady tone

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 3f2dba80c902a5989661c5e0e073adffccde4cbd
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Wed Oct 9 00:44:41 2013 +0300

    SF: draw EMG steady tone
---
 upstream/ChangeLog                               |   13 +++++----
 upstream/data/sf.glade                           |   32 ++++++++++++++--------
 upstream/src/aghermann/rk1968/rk1968.hh          |    1 -
 upstream/src/aghermann/ui/sf/channel.cc          |   10 +++++--
 upstream/src/aghermann/ui/sf/channel.hh          |    5 ++--
 upstream/src/aghermann/ui/sf/construct.cc        |    2 ++
 upstream/src/aghermann/ui/sf/montage-menus_cb.cc |   12 ++++++++
 upstream/src/aghermann/ui/sf/montage.cc          |   13 +++++++--
 upstream/src/aghermann/ui/sf/sf_cb.hh            |    1 +
 upstream/src/aghermann/ui/sf/widgets.hh          |    1 +
 10 files changed, 64 insertions(+), 26 deletions(-)

diff --git a/upstream/ChangeLog b/upstream/ChangeLog
index 2f4dbef..20af068 100644
--- a/upstream/ChangeLog
+++ b/upstream/ChangeLog
@@ -1,14 +1,15 @@
 v.0.9.2 (2013-xx-xx)
-	* Misc: Separate upstream tree from various distribution-related files.
-	* Misc: SF: trivial optimisation in pattern search.
-	* Fix: SF: load patterns from symlinked files.
+	* New: Get a reasonable logging facility (use -l file; "-" is stdout; default is /dev/null).
+	* New: Properly handle various system/user/experiment/subject/session stored settings packs (patterns, rk1968, etc).
+	* New: SF: basic dialog for RK1968 scoring assistant parameters.
+	* New: SF: draw EMG steady tone.
 	* Fix: SF: don't blindly delete files in various pattern locations, just append ~ to their file names.
 	* Fix: SF: fix jump to next/prev annotations.
+	* Fix: SF: load patterns from symlinked files.
 	* Fix: Use subject ID in place of name if the latter is missing.
-	* New: Properly handle various system/user/experiment/subject/session stored settings packs (patterns, rk1968, etc).
 	* Misc: Incorporate edfhed.glade in aghermann.gresources.
-	* New: SF: basic dialog for RK1968 scoring assistant parameters.
-	* New: Get a reasonable logging facility (use -l file; "-" is stdout; default is /dev/null).
+	* Misc: SF: trivial optimisation in pattern search.
+	* Misc: Separate upstream tree from various distribution-related files.
 
 v.0.9.1.1 (2013-07-24)
 	* Fix 32-bit builds where sizeof(size_t) != sizeof(unsigned long).
diff --git a/upstream/data/sf.glade b/upstream/data/sf.glade
index 57fc200..94ba205 100644
--- a/upstream/data/sf.glade
+++ b/upstream/data/sf.glade
@@ -122,6 +122,14 @@
               </object>
             </child>
             <child>
+              <object class="GtkCheckMenuItem" id="iSFPageDrawEMGSteadyTone">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">E_MG steady tone</property>
+                <property name="use_underline">True</property>
+              </object>
+            </child>
+            <child>
               <object class="GtkMenuItem" id="iiSFPagePhasicEvents">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -1474,18 +1482,6 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkSeparator" id="separator6">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="orientation">vertical</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">9</property>
-                      </packing>
-                    </child>
-                    <child>
                       <object class="GtkTable" id="cSFSleepStageStats">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
@@ -1618,6 +1614,18 @@
                       </packing>
                     </child>
                     <child>
+                      <object class="GtkSeparator" id="separator6">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="orientation">vertical</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">9</property>
+                      </packing>
+                    </child>
+                    <child>
                       <object class="GtkSeparator" id="separator4">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
diff --git a/upstream/src/aghermann/rk1968/rk1968.hh b/upstream/src/aghermann/rk1968/rk1968.hh
index 6d9e892..5bbd2f0 100644
--- a/upstream/src/aghermann/rk1968/rk1968.hh
+++ b/upstream/src/aghermann/rk1968/rk1968.hh
@@ -113,7 +113,6 @@ emg_steady_tone( const sigproc::SSignalRef<T>& V, size_t steady_secs, double max
         for ( int sec = 0; sec < V.signal.size() / V.samplerate - steady_secs - 1; ++sec ) {
                 auto range = slice (sec * s, s, 1);
                 bench[sec % steady_secs] = V.signal[range].sum() / s;
-                printf( "r[%zu] = %g\n", sec, bench[sec % steady_secs]);
                 if ( sec < steady_secs )
                         continue;
                 T avg = bench.sum() / steady_secs;
diff --git a/upstream/src/aghermann/ui/sf/channel.cc b/upstream/src/aghermann/ui/sf/channel.cc
index a4fd284..479d9ec 100644
--- a/upstream/src/aghermann/ui/sf/channel.cc
+++ b/upstream/src/aghermann/ui/sf/channel.cc
@@ -69,6 +69,7 @@ SChannel (agh::CRecording& r,
         draw_phasic_spindle (true),
         draw_phasic_Kcomplex (true),
         draw_phasic_eyeblink (true),
+        draw_emg_steady_tone (true),
         apply_reconstituted (false),
         marquee_start (0.),
         marquee_end (0.),
@@ -91,6 +92,7 @@ SChannel (agh::CRecording& r,
                 ( string("h")+to_string(seq) + ".draw_phasic_spindle",     &draw_phasic_spindle)
                 ( string("h")+to_string(seq) + ".draw_phasic_Kcomplex",    &draw_phasic_Kcomplex)
                 ( string("h")+to_string(seq) + ".draw_phasic_eyeblink",    &draw_phasic_eyeblink)
+                ( string("h")+to_string(seq) + ".draw_emg_steady_tone",    &draw_emg_steady_tone)
                 ( string("h")+to_string(seq) + ".autoscale_profile",       &autoscale_profile)
                 ( string("h")+to_string(seq) + ".resample_signal",         &resample_signal)
                 ( string("h")+to_string(seq) + ".resample_power",          &resample_power)
@@ -158,13 +160,13 @@ SChannel (agh::CRecording& r,
                 static const size_t steady_secs = 10;
                 static const double max_dev_factor = 1.1;
                 size_t steady_tone_at;
-                tie (steady_tone, steady_tone_at) =
+                tie (emg_steady_tone, steady_tone_at) =
                         agh::rk1968::emg_steady_tone(
-                                sigproc::SSignalRef<TFloat> {raw_profile, 1. / raw_profile_dt},
+                                sigproc::SSignalRef<TFloat> {raw_profile, size_t(roundf(1. / raw_profile_dt))},
                                 steady_secs,
                                 max_dev_factor);
 
-                APPLOG_INFO ( "%s amplitude max %g count %zu, binsize %g; steady tone %g at %g sec", name(), raw_profile.max(), histogram.max(), hist_binsize, steady_tone, steady_tone_at * raw_profile_dt);
+                APPLOG_INFO ( "%s amplitude max %g count %zu, binsize %g; steady tone %g at %g sec", name(), raw_profile.max(), histogram.max(), hist_binsize, emg_steady_tone, steady_tone_at * raw_profile_dt);
         }
 
       // let it be so to avoid libconfig::readFile throwing exceptions
@@ -547,6 +549,7 @@ update_channel_menu_items( const double x)
         gtk_check_menu_item_set_active( _p.iSFPageDrawPhasicSpindles,   draw_phasic_spindle);
         gtk_check_menu_item_set_active( _p.iSFPageDrawPhasicKComplexes, draw_phasic_Kcomplex);
         gtk_check_menu_item_set_active( _p.iSFPageDrawPhasicEyeBlinks,  draw_phasic_eyeblink);
+        gtk_check_menu_item_set_active( _p.iSFPageDrawEMGSteadyTone,    draw_emg_steady_tone);
 
         gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawCourse,   draw_selection_course);
         gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawEnvelope, draw_selection_envelope);
@@ -564,6 +567,7 @@ update_channel_menu_items( const double x)
         gtk_widget_set_visible( (GtkWidget*)_p.iSFPageArtifactsDetect, is_eeg and not _p.artifacts_dialog_shown);
         gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawMCProfile,   is_eeg);
         gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawEMGProfile,  is_emg);
+        gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawEMGSteadyTone, is_emg);
 
         double cpos = _p.time_at_click( x);
 
diff --git a/upstream/src/aghermann/ui/sf/channel.hh b/upstream/src/aghermann/ui/sf/channel.hh
index 1b6c3e1..3a65200 100644
--- a/upstream/src/aghermann/ui/sf/channel.hh
+++ b/upstream/src/aghermann/ui/sf/channel.hh
@@ -178,7 +178,7 @@ struct SScoringFacility::SChannel {
         void
         get_raw_profile();
 
-        TFloat  steady_tone;
+        TFloat  emg_steady_tone;
         valarray<size_t>
                 histogram;
         static const size_t hist_bins = 20;
@@ -219,7 +219,8 @@ struct SScoringFacility::SChannel {
                 draw_selection_dzcdf,
                 draw_phasic_spindle,
                 draw_phasic_Kcomplex,
-                draw_phasic_eyeblink;
+                draw_phasic_eyeblink,
+                draw_emg_steady_tone;
         bool    discard_marked,
                 apply_reconstituted;
 
diff --git a/upstream/src/aghermann/ui/sf/construct.cc b/upstream/src/aghermann/ui/sf/construct.cc
index aa4fd94..fcc254c 100644
--- a/upstream/src/aghermann/ui/sf/construct.cc
+++ b/upstream/src/aghermann/ui/sf/construct.cc
@@ -221,6 +221,7 @@ SScoringFacilityWidgets ()
         AGH_GBGETOBJ (iSFPageShowProcessed);
         AGH_GBGETOBJ (iSFPageUseResample);
         AGH_GBGETOBJ (iSFPageDrawZeroline);
+        AGH_GBGETOBJ (iSFPageDrawEMGSteadyTone);
         AGH_GBGETOBJ (iSFPageProfilesSubmenuSeparator);
         AGH_GBGETOBJ (iSFPageDrawPSDProfile);
         AGH_GBGETOBJ (iSFPageDrawPSDSpectrum);
@@ -272,6 +273,7 @@ SScoringFacilityWidgets ()
         G_CONNECT_1 (iSFPageShowProcessed, toggled);
         G_CONNECT_1 (iSFPageUseResample, toggled);
         G_CONNECT_1 (iSFPageDrawZeroline, toggled);
+        G_CONNECT_1 (iSFPageDrawEMGSteadyTone, toggled);
 
         G_CONNECT_1 (iSFPageAnnotationDelete, activate);
         G_CONNECT_1 (iSFPageAnnotationEdit, activate);
diff --git a/upstream/src/aghermann/ui/sf/montage-menus_cb.cc b/upstream/src/aghermann/ui/sf/montage-menus_cb.cc
index 579d359..8c910c5 100644
--- a/upstream/src/aghermann/ui/sf/montage-menus_cb.cc
+++ b/upstream/src/aghermann/ui/sf/montage-menus_cb.cc
@@ -88,6 +88,18 @@ iSFPageDrawZeroline_toggled_cb(
 }
 
 void
+iSFPageDrawEMGSteadyTone_toggled_cb(
+        GtkCheckMenuItem *checkmenuitem,
+        const gpointer userdata)
+{
+        auto& SF = *(SScoringFacility*)userdata;
+        if ( SF.suppress_redraw )
+                return;
+        SF.using_channel->draw_emg_steady_tone = (bool)gtk_check_menu_item_get_active( checkmenuitem);
+        gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
+}
+
+void
 iSFPageHide_activate_cb(
         GtkMenuItem*,
         const gpointer userdata)
diff --git a/upstream/src/aghermann/ui/sf/montage.cc b/upstream/src/aghermann/ui/sf/montage.cc
index 6d95c67..44daf77 100644
--- a/upstream/src/aghermann/ui/sf/montage.cc
+++ b/upstream/src/aghermann/ui/sf/montage.cc
@@ -401,8 +401,6 @@ draw_page( cairo_t *cr,
                         one_signal_drawn = true;
                         cairo_stroke( cr);
                 }
-
-                
         }
 
       // waveform: signal_original
@@ -618,6 +616,17 @@ draw_page( cairo_t *cr,
                 cairo_stroke( cr);
         }
 
+       // EMG baseline tone
+        if ( draw_emg_steady_tone && schannel().type() == sigfile::SChannel::TType::emg ) {
+                cairo_set_line_width( cr, 1.);
+                _p._p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr);
+                cairo_move_to( cr, 0, y0 - emg_steady_tone/2 * signal_display_scale);
+                cairo_rel_line_to( cr, wd, 0);
+                cairo_move_to( cr, 0, y0 + emg_steady_tone/2 * signal_display_scale);
+                cairo_rel_line_to( cr, wd, 0);
+                cairo_stroke( cr);
+        }
+
        // applied filters legend
         {
                 cairo_set_font_size( cr, 9);
diff --git a/upstream/src/aghermann/ui/sf/sf_cb.hh b/upstream/src/aghermann/ui/sf/sf_cb.hh
index 6060029..e8ad8f3 100644
--- a/upstream/src/aghermann/ui/sf/sf_cb.hh
+++ b/upstream/src/aghermann/ui/sf/sf_cb.hh
@@ -90,6 +90,7 @@ void iSFPageShowOriginal_toggled_cb( GtkCheckMenuItem*, gpointer);
 void iSFPageShowProcessed_toggled_cb( GtkCheckMenuItem*, gpointer);
 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 iSFPageArtifactsClear_activate_cb( GtkMenuItem*, gpointer);
diff --git a/upstream/src/aghermann/ui/sf/widgets.hh b/upstream/src/aghermann/ui/sf/widgets.hh
index 8567119..35d64bd 100644
--- a/upstream/src/aghermann/ui/sf/widgets.hh
+++ b/upstream/src/aghermann/ui/sf/widgets.hh
@@ -146,6 +146,7 @@ struct SScoringFacilityWidgets {
         GtkCheckMenuItem
                 *iSFPageShowOriginal, *iSFPageShowProcessed,
                 *iSFPageUseResample, *iSFPageDrawZeroline,
+                *iSFPageDrawEMGSteadyTone,
                 *iSFPageDrawPSDProfile,
                 *iSFPageDrawPSDSpectrum,
                 *iSFPageDrawSWUProfile,

-- 
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