This is an automated email from the git hooks/post-receive script. hmmr-guest pushed a commit to branch WIP in repository aghermann.
commit dabf05c72a100094fc607904fb7df0d762512dfa Author: Andrei Zavada <[email protected]> Date: Mon Oct 21 01:21:24 2013 +0300 unify the three artifact detection algorithms (part 4/4) --- upstream/data/sf-artifacts.glade | 112 ++++++++++---------- upstream/src/aghermann/artifact-detection/3in1.cc | 1 + upstream/src/aghermann/ui/sf/channel.cc | 7 +- .../src/aghermann/ui/sf/d/artifacts-profiles_cb.cc | 5 + upstream/src/aghermann/ui/sf/d/artifacts.cc | 6 ++ upstream/src/aghermann/ui/sf/d/artifacts.hh | 9 ++ upstream/src/aghermann/ui/sf/d/artifacts_cb.cc | 86 +++++++++++++-- 7 files changed, 155 insertions(+), 71 deletions(-) diff --git a/upstream/data/sf-artifacts.glade b/upstream/data/sf-artifacts.glade index eb119d8..f7c620c 100644 --- a/upstream/data/sf-artifacts.glade +++ b/upstream/data/sf-artifacts.glade @@ -1,6 +1,39 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> <!-- interface-requires gtk+ 3.0 --> + <object class="GtkAdjustment" id="jSFADLowerThr"> + <property name="lower">-30</property> + <property name="upper">-1</property> + <property name="value">-9</property> + <property name="step_increment">0.5</property> + <property name="page_increment">2</property> + </object> + <object class="GtkAdjustment" id="jSFADMCGain"> + <property name="lower">1</property> + <property name="upper">100</property> + <property name="value">10</property> + <property name="step_increment">0.5</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="jSFADScope"> + <property name="lower">1</property> + <property name="upper">60</property> + <property name="value">4</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkAdjustment" id="jSFADSmoothSide"> + <property name="upper">8</property> + <property name="step_increment">1</property> + <property name="page_increment">2</property> + </object> + <object class="GtkAdjustment" id="jSFADUpperThr"> + <property name="lower">1</property> + <property name="upper">30</property> + <property name="value">9</property> + <property name="step_increment">0.5</property> + <property name="page_increment">2</property> + </object> <object class="GtkAdjustment" id="jSFADBackpolate"> <property name="upper">1</property> <property name="value">0.5</property> @@ -49,6 +82,13 @@ <property name="step_increment">0.25</property> <property name="page_increment">1</property> </object> + <object class="GtkAdjustment" id="jSFADFlatMinRegionSize"> + <property name="lower">0.050000000000000003</property> + <property name="upper">120</property> + <property name="value">0.5</property> + <property name="step_increment">0.050000000000000003</property> + <property name="page_increment">0.5</property> + </object> <object class="GtkAdjustment" id="jSFADFlatPad"> <property name="upper">10</property> <property name="value">0.20000000000000001</property> @@ -74,46 +114,6 @@ <property name="step_increment">1</property> <property name="page_increment">10</property> </object> - <object class="GtkAdjustment" id="jSFADLowerThr"> - <property name="lower">-30</property> - <property name="upper">-1</property> - <property name="value">-9</property> - <property name="step_increment">0.5</property> - <property name="page_increment">2</property> - </object> - <object class="GtkAdjustment" id="jSFADMCGain"> - <property name="lower">1</property> - <property name="upper">100</property> - <property name="value">10</property> - <property name="step_increment">0.5</property> - <property name="page_increment">1</property> - </object> - <object class="GtkAdjustment" id="jSFADScope"> - <property name="lower">1</property> - <property name="upper">60</property> - <property name="value">4</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkAdjustment" id="jSFADSmoothSide"> - <property name="upper">8</property> - <property name="step_increment">1</property> - <property name="page_increment">2</property> - </object> - <object class="GtkAdjustment" id="jSFADUpperThr"> - <property name="lower">1</property> - <property name="upper">30</property> - <property name="value">9</property> - <property name="step_increment">0.5</property> - <property name="page_increment">2</property> - </object> - <object class="GtkAdjustment" id="jSFADFlatMinRegionSize"> - <property name="lower">0.050000000000000003</property> - <property name="upper">120</property> - <property name="value">0.5</property> - <property name="step_increment">0.050000000000000003</property> - <property name="page_increment">0.5</property> - </object> <object class="GtkDialog" id="wSFAD"> <property name="can_focus">False</property> <property name="border_width">5</property> @@ -281,7 +281,7 @@ </packing> </child> <child> - <object class="GtkExpander" id="expander1"> + <object class="GtkExpander" id="cSFADMCBasedExpander"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="resize_toplevel">True</property> @@ -997,7 +997,18 @@ </packing> </child> <child> - <placeholder/> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">1</property> + <property name="label" translatable="yes">Inspect every</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> </child> <child> <placeholder/> @@ -1012,18 +1023,7 @@ <placeholder/> </child> <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="label" translatable="yes">Inspect every</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> + <placeholder/> </child> </object> </child> @@ -1087,7 +1087,7 @@ </packing> </child> <child> - <object class="GtkExpander" id="expander2"> + <object class="GtkExpander" id="cSFADFlatExpander"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -1251,7 +1251,7 @@ </packing> </child> <child> - <object class="GtkExpander" id="expander3"> + <object class="GtkExpander" id="cSFADEMGExpander"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> diff --git a/upstream/src/aghermann/artifact-detection/3in1.cc b/upstream/src/aghermann/artifact-detection/3in1.cc index 2d8c899..a9823d4 100644 --- a/upstream/src/aghermann/artifact-detection/3in1.cc +++ b/upstream/src/aghermann/artifact-detection/3in1.cc @@ -129,6 +129,7 @@ detect_artifacts( sigfile::SNamedChannel& N, 1., P.emg_min_steadytone_run); for ( size_t t = 0; t < emg_raw_profile.size(); ++t ) if ( emg_raw_profile[t] > this_steady_tone * P.emg_min_steadytone_factor ) { + marked_some = true; AF.mark_artifact( (t+0) * P.emg_min_steadytone_run, (t+1) * P.emg_min_steadytone_run); diff --git a/upstream/src/aghermann/ui/sf/channel.cc b/upstream/src/aghermann/ui/sf/channel.cc index f3485b9..241d251 100644 --- a/upstream/src/aghermann/ui/sf/channel.cc +++ b/upstream/src/aghermann/ui/sf/channel.cc @@ -391,10 +391,7 @@ float SScoringFacility::SChannel:: calculate_dirty_percent() { - size_t total = 0; // in samples - for ( auto &A : artifacts() ) - total += A.size(); - return percent_dirty = (float)total / n_samples(); + return percent_dirty = 100 * artifacts.region_dirty_fraction( 0., crecording.F().recording_time()); } @@ -520,7 +517,7 @@ update_channel_menu_items( const double x) gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawPSDSpectrum, is_eeg); gtk_widget_set_visible( (GtkWidget*)_p.iSFPageDrawSWUProfile, is_eeg); - gtk_widget_set_visible( (GtkWidget*)_p.iSFPageArtifactsDetect, is_eeg and not _p.artifacts_dialog_shown); + gtk_widget_set_visible( (GtkWidget*)_p.iSFPageArtifactsDetect, is_eeg); 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); diff --git a/upstream/src/aghermann/ui/sf/d/artifacts-profiles_cb.cc b/upstream/src/aghermann/ui/sf/d/artifacts-profiles_cb.cc index 0d5c59b..0c606cd 100644 --- a/upstream/src/aghermann/ui/sf/d/artifacts-profiles_cb.cc +++ b/upstream/src/aghermann/ui/sf/d/artifacts-profiles_cb.cc @@ -22,6 +22,11 @@ void eSFADProfileList_changed_cb( { auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata; + for ( auto& W : {AD.cSFADMCBasedExpander, AD.cSFADFlatExpander, AD.cSFADEMGExpander} ) { + g_signal_emit_by_name( W, "activate"); + g_signal_emit_by_name( W, "activate"); + } + AD.eXProfileList_changed_cb(); } diff --git a/upstream/src/aghermann/ui/sf/d/artifacts.cc b/upstream/src/aghermann/ui/sf/d/artifacts.cc index 8051321..9079c5d 100644 --- a/upstream/src/aghermann/ui/sf/d/artifacts.cc +++ b/upstream/src/aghermann/ui/sf/d/artifacts.cc @@ -56,6 +56,7 @@ SArtifactsDialog (SScoringFacility& p_) AGH_GBGETOBJ (eSFADProfileSaveOriginUser); AGH_GBGETOBJ (bSFADProfileSaveOK); + AGH_GBGETOBJ (cSFADMCBasedExpander); AGH_GBGETOBJ (lSFADMCBasedSummary); AGH_GBGETOBJ (eSFADMCBasedConsider); AGH_GBGETOBJ (cSFADMCBased); @@ -79,12 +80,14 @@ SArtifactsDialog (SScoringFacility& p_) AGH_GBGETOBJ (cSFADWhenEstimateEOn); AGH_GBGETOBJ (cSFADWhenEstimateEOff); + AGH_GBGETOBJ (cSFADFlatExpander); AGH_GBGETOBJ (lSFADFlatSummary); AGH_GBGETOBJ (eSFADFlatConsider); AGH_GBGETOBJ (cSFADFlat); AGH_GBGETOBJ (eSFADFlatMinRegionSize); AGH_GBGETOBJ (eSFADFlatPad); + AGH_GBGETOBJ (cSFADEMGExpander); AGH_GBGETOBJ (lSFADEMGSummary); AGH_GBGETOBJ (eSFADEMGConsider); AGH_GBGETOBJ (cSFADEMG); @@ -113,6 +116,9 @@ SArtifactsDialog (SScoringFacility& p_) G_CONNECT_1 (bSFADProfileRevert, clicked); G_CONNECT_1 (bSFADProfileDiscard, clicked); + G_CONNECT_1 (cSFADMCBasedExpander, activate); + G_CONNECT_1 (cSFADFlatExpander, activate); + G_CONNECT_1 (cSFADEMGExpander, activate); G_CONNECT_1 (eSFADMCBasedConsider, toggled); G_CONNECT_1 (eSFADFlatConsider, toggled); G_CONNECT_1 (eSFADEMGConsider, toggled); diff --git a/upstream/src/aghermann/ui/sf/d/artifacts.hh b/upstream/src/aghermann/ui/sf/d/artifacts.hh index 43e357c..639d60b 100644 --- a/upstream/src/aghermann/ui/sf/d/artifacts.hh +++ b/upstream/src/aghermann/ui/sf/d/artifacts.hh @@ -78,6 +78,8 @@ struct SScoringFacility::SArtifactsDialog // B. Contents // 1. MC-based + GtkExpander + *cSFADMCBasedExpander; GtkLabel *lSFADMCBasedSummary; GtkTable @@ -109,6 +111,8 @@ struct SScoringFacility::SArtifactsDialog *cSFADWhenEstimateEOff; // 2. Flat regions + GtkExpander + *cSFADFlatExpander; GtkLabel *lSFADFlatSummary; GtkTable @@ -120,6 +124,8 @@ struct SScoringFacility::SArtifactsDialog *eSFADFlatPad; // 3. EMG perturbations + GtkExpander + *cSFADEMGExpander; GtkLabel *lSFADEMGSummary; GtkTable @@ -155,6 +161,9 @@ void bSFADProfileSave_clicked_cb( GtkButton*, gpointer); void bSFADProfileRevert_clicked_cb( GtkButton*, gpointer); void bSFADProfileDiscard_clicked_cb( GtkButton*, gpointer); +void cSFADMCBasedExpander_activate_cb( GtkExpander*, gpointer); +void cSFADFlatExpander_activate_cb( GtkExpander*, gpointer); +void cSFADEMGExpander_activate_cb( GtkExpander*, gpointer); void eSFADMCBasedConsider_toggled_cb( GtkToggleButton*, gpointer); void eSFADFlatConsider_toggled_cb( GtkToggleButton*, gpointer); void eSFADEMGConsider_toggled_cb( GtkToggleButton*, gpointer); diff --git a/upstream/src/aghermann/ui/sf/d/artifacts_cb.cc b/upstream/src/aghermann/ui/sf/d/artifacts_cb.cc index 727c460..34d0135 100644 --- a/upstream/src/aghermann/ui/sf/d/artifacts_cb.cc +++ b/upstream/src/aghermann/ui/sf/d/artifacts_cb.cc @@ -36,12 +36,15 @@ wSFAD_show_cb( *SF._p.ED, agh::SExpDirLevelId {SF._p.ED->group_of(SF.csubject()), SF.csubject().id, SF.session()}); AD.populate_combo(); + if ( gtk_combo_box_get_active( AD.eSFADProfileList) == -1 ) + gtk_combo_box_set_active( AD.eSFADProfileList, 0); + AD.set_profile_manage_buttons_visibility(); - // g_signal_emit_by_name( AD.eSFADEstimateE, "toggled"); - // g_signal_emit_by_name( AD.eSFADEstimateE, "toggled"); - // g_signal_emit_by_name( AD.eSFADUseThisRange, "toggled"); - // g_signal_emit_by_name( AD.eSFADUseThisRange, "toggled"); + for ( auto& W : {AD.cSFADMCBasedExpander, AD.cSFADFlatExpander, AD.cSFADEMGExpander} ) { + g_signal_emit_by_name( W, "activate"); + g_signal_emit_by_name( W, "activate"); + } gtk_widget_set_sensitive( (GtkWidget*)AD.bSFADApply, FALSE); AD.suppress_preview_handler = true; @@ -52,10 +55,10 @@ wSFAD_show_cb( gtk_label_set_text( AD.lSFADInfo, - snprintf_buf( "Artifact detection in channel %s", AD.using_channel->name())); + snprintf_buf( "Artifact detection in %s", AD.using_channel->name())); gtk_label_set_text( AD.lSFADDirtyPercent, - snprintf_buf( "%4.2f%% marked", AD.using_channel->calculate_dirty_percent() * 100)); + snprintf_buf( "%4.2f%% marked", AD.using_channel->calculate_dirty_percent())); } gboolean @@ -77,6 +80,65 @@ wSFAD_close_cb( } + +void +cSFADMCBasedExpander_activate_cb( + GtkExpander* expander, + const gpointer userdata) +{ + auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata; + + bool yesitis = !gtk_expander_get_expanded( expander); + auto& P = AD.Pp2.Pp.MC; + gtk_label_set_text( + AD.lSFADMCBasedSummary, + yesitis + ? "" + : snprintf_buf( + "at:%g thr:%g..%g f %g:%g:%g g:%g bp:%g E:%g d:%g..%g hs:%zu sm:%zu estE:%d range:%d", + P.scope, P.upper_thr, P.lower_thr, P.f0, P.fc, P.bandwidth, P.mc_gain, P.iir_backpolate, + P.E, P.dmin, P.dmax, P.sssu_hist_size, P.smooth_side, + P.estimate_E, P.use_range)); +} + +void +cSFADFlatExpander_activate_cb( + GtkExpander* expander, + const gpointer userdata) +{ + auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata; + + bool yesitis = !gtk_expander_get_expanded( expander); + auto& P = AD.Pp2.Pp; + gtk_label_set_text( + AD.lSFADFlatSummary, + yesitis + ? "" + : snprintf_buf( + "min_size:%g pad:%g", + P.flat_min_size, P.flat_pad)); +} + +void +cSFADEMGExpander_activate_cb( + GtkExpander* expander, + const gpointer userdata) +{ + auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata; + + bool yesitis = !gtk_expander_get_expanded( expander); + auto& P = AD.Pp2.Pp; + gtk_label_set_text( + AD.lSFADEMGSummary, + yesitis + ? "" + : snprintf_buf( + "factor:%g run:%g", + P.emg_min_steadytone_factor, P.emg_min_steadytone_run)); +} + + + void eSFADMCBasedConsider_toggled_cb( GtkToggleButton *b, @@ -84,9 +146,10 @@ eSFADMCBasedConsider_toggled_cb( { auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata; + bool enabled = gtk_toggle_button_get_active( b); gtk_widget_set_sensitive( (GtkWidget*)AD.cSFADMCBased, - gtk_toggle_button_get_active( b)); + enabled); AD.eX_any_profile_value_changed_cb(); } @@ -98,9 +161,10 @@ eSFADFlatConsider_toggled_cb( { auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata; + bool enabled = gtk_toggle_button_get_active( b); gtk_widget_set_sensitive( (GtkWidget*)AD.cSFADFlat, - gtk_toggle_button_get_active( b)); + enabled); AD.eX_any_profile_value_changed_cb(); } @@ -112,9 +176,10 @@ eSFADEMGConsider_toggled_cb( { auto& AD = *(SScoringFacility::SArtifactsDialog*)userdata; + bool enabled = gtk_toggle_button_get_active( b); gtk_widget_set_sensitive( (GtkWidget*)AD.cSFADEMG, - gtk_toggle_button_get_active( b)); + enabled); AD.eX_any_profile_value_changed_cb(); } @@ -240,6 +305,7 @@ bSFADPreview_toggled_cb( } else { AD.using_channel->artifacts = AD.artifacts_backup; + AD.using_channel->calculate_dirty_percent(); for ( auto& H : AD.channels_visible_backup ) H.first->hidden = H.second; AD.using_channel->draw_original_signal = AD.orig_signal_visible_backup; @@ -250,7 +316,7 @@ bSFADPreview_toggled_cb( gtk_label_set_markup( AD.lSFADDirtyPercent, - snprintf_buf( "%4.2f%% marked", AD.using_channel->calculate_dirty_percent() * 100)); + snprintf_buf( "%4.2f%%", AD.using_channel->percent_dirty)); gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage); gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram); -- Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
