[med-svn] [SCM] aghermann branch, master, updated. 4f7a3b774136ffffbaf9b05d90bd568347bc5461

Andrei Zavada johnhommer at gmail.com
Fri Nov 16 00:50:07 UTC 2012


The following commit has been merged in the master branch:
commit d4ee6398289981e44a5aa903f15ef02e1ffc52b3
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Mon Oct 8 01:20:59 2012 +0300

    enable single (affected) channel preview in Artifact Detection dialog

diff --git a/data/sf.glade b/data/sf.glade
index 356b4ad..79710b0 100644
--- a/data/sf.glade
+++ b/data/sf.glade
@@ -1,6 +1,33 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkAdjustment" id="jHighPassCutoff">
+    <property name="upper">100</property>
+    <property name="step_increment">0.25</property>
+    <property name="page_increment">1</property>
+  </object>
+  <object class="GtkAdjustment" id="jHighPassOrder">
+    <property name="upper">5</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="jLowPassCutoff">
+    <property name="upper">100</property>
+    <property name="step_increment">0.25</property>
+    <property name="page_increment">1</property>
+  </object>
+  <object class="GtkAdjustment" id="jLowPassOrder">
+    <property name="lower">1</property>
+    <property name="upper">5</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="jPageNo">
+    <property name="lower">1</property>
+    <property name="upper">99999</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkAdjustment" id="jPatternEnvTightness">
     <property name="lower">1</property>
     <property name="upper">20</property>
@@ -157,33 +184,6 @@
     <property name="step_increment">0.5</property>
     <property name="page_increment">2</property>
   </object>
-  <object class="GtkAdjustment" id="jHighPassCutoff">
-    <property name="upper">100</property>
-    <property name="step_increment">0.25</property>
-    <property name="page_increment">1</property>
-  </object>
-  <object class="GtkAdjustment" id="jHighPassOrder">
-    <property name="upper">5</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkAdjustment" id="jLowPassCutoff">
-    <property name="upper">100</property>
-    <property name="step_increment">0.25</property>
-    <property name="page_increment">1</property>
-  </object>
-  <object class="GtkAdjustment" id="jLowPassOrder">
-    <property name="lower">1</property>
-    <property name="upper">5</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkAdjustment" id="jPageNo">
-    <property name="lower">1</property>
-    <property name="upper">99999</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
   <object class="GtkAdjustment" id="jSFICAEigVecFirst">
     <property name="lower">1</property>
     <property name="upper">100</property>
@@ -2832,15 +2832,15 @@ on individual parameters:</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="bScoreWake">
-                        <property name="label" translatable="yes">☺</property>
+                      <object class="GtkButton" id="bScoreClear">
+                        <property name="label" translatable="yes">⌫</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
-                        <property name="tooltip_markup" translatable="yes">Wake (<b>w</b>)</property>
+                        <property name="tooltip_markup" translatable="yes">Clear (<b>q</b>)</property>
                         <property name="valign">center</property>
                         <property name="focus_on_click">False</property>
-                        <accelerator key="w" signal="activate"/>
+                        <accelerator key="q" signal="activate"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -2849,15 +2849,15 @@ on individual parameters:</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkButton" id="bScoreClear">
-                        <property name="label" translatable="yes">⌫</property>
+                      <object class="GtkButton" id="bScoreWake">
+                        <property name="label" translatable="yes">☺</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
-                        <property name="tooltip_markup" translatable="yes">Clear (<b>q</b>)</property>
+                        <property name="tooltip_markup" translatable="yes">Wake (<b>w</b>)</property>
                         <property name="valign">center</property>
                         <property name="focus_on_click">False</property>
-                        <accelerator key="q" signal="activate"/>
+                        <accelerator key="w" signal="activate"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -3092,17 +3092,18 @@ on individual parameters:</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkToggleButton" id="bSFShowPhaseDiffDialog">
-                        <property name="label" translatable="yes">Δφ</property>
+                      <object class="GtkToggleButton" id="bSFShowFindDialog">
+                        <property name="label" translatable="yes">_Find</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <property name="has_tooltip">True</property>
-                        <property name="tooltip_markup" translatable="yes">Interchannel signal shift (<b>F4</b>)</property>
-                        <property name="tooltip_text" translatable="yes">Interchannel signal shift (F4)</property>
+                        <property name="tooltip_markup" translatable="yes">Find/manage patterns (<b>F3</b>)</property>
+                        <property name="tooltip_text" translatable="yes">Find/manage patterns (F3)</property>
                         <property name="valign">center</property>
+                        <property name="use_underline">True</property>
                         <property name="focus_on_click">False</property>
-                        <accelerator key="F4" signal="activate"/>
+                        <accelerator key="F3" signal="activate"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -3112,18 +3113,17 @@ on individual parameters:</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkToggleButton" id="bSFShowFindDialog">
-                        <property name="label" translatable="yes">_Find</property>
+                      <object class="GtkToggleButton" id="bSFShowPhaseDiffDialog">
+                        <property name="label" translatable="yes">Δφ</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
                         <property name="has_tooltip">True</property>
-                        <property name="tooltip_markup" translatable="yes">Find/manage patterns (<b>F3</b>)</property>
-                        <property name="tooltip_text" translatable="yes">Find/manage patterns (F3)</property>
+                        <property name="tooltip_markup" translatable="yes">Interchannel signal shift (<b>F4</b>)</property>
+                        <property name="tooltip_text" translatable="yes">Interchannel signal shift (F4)</property>
                         <property name="valign">center</property>
-                        <property name="use_underline">True</property>
                         <property name="focus_on_click">False</property>
-                        <accelerator key="F3" signal="activate"/>
+                        <accelerator key="F4" signal="activate"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -4064,22 +4064,6 @@ skew:	𝑔(𝑢) = 𝑢2</property>
               </packing>
             </child>
             <child>
-              <object class="GtkCheckButton" id="eSFADClearOldArtifacts">
-                <property name="label" translatable="yes">Clear all previous artifacts</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="xalign">0</property>
-                <property name="draw_indicator">True</property>
-              </object>
-              <packing>
-                <property name="left_attach">4</property>
-                <property name="top_attach">12</property>
-                <property name="width">3</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkSeparator" id="separator15">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -4757,12 +4741,50 @@ skew:	𝑔(𝑢) = 𝑢2</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
-                <property name="top_attach">13</property>
+                <property name="top_attach">14</property>
                 <property name="width">7</property>
                 <property name="height">1</property>
               </packing>
             </child>
             <child>
+              <object class="GtkCheckButton" id="eSFADSingleChannelPreview">
+                <property name="label" translatable="yes">Hide other channels in preview</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="xalign">0</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">4</property>
+                <property name="top_attach">13</property>
+                <property name="width">3</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
               <placeholder/>
             </child>
             <child>
diff --git a/src/ui/scoring-facility-artifacts.cc b/src/ui/scoring-facility-artifacts.cc
index 6b3cc1d..c90dd58 100644
--- a/src/ui/scoring-facility-artifacts.cc
+++ b/src/ui/scoring-facility-artifacts.cc
@@ -15,11 +15,10 @@
 #include "scoring-facility-widgets.hh"
 
 using namespace std;
-using namespace aghui;
 
 
 aghui::SScoringFacility::SChannel::SDetectArtifactsParams
-SScoringFacility::get_mc_params_from_SFAD_widgets() const
+aghui::SScoringFacility::get_mc_params_from_SFAD_widgets() const
 {
 	return SChannel::SDetectArtifactsParams {
 		(float)gtk_spin_button_get_value( eSFADScope),
@@ -41,7 +40,6 @@ SScoringFacility::get_mc_params_from_SFAD_widgets() const
 
 		(size_t)round(gtk_spin_button_get_value( eSFADSmoothSide)),
 
-		(bool)gtk_toggle_button_get_active( (GtkToggleButton*)eSFADClearOldArtifacts),
 		(bool)gtk_toggle_button_get_active( (GtkToggleButton*)eSFADUseThisRange)
 	};
 }
diff --git a/src/ui/scoring-facility-artifacts_cb.cc b/src/ui/scoring-facility-artifacts_cb.cc
index 4c11db5..4450717 100644
--- a/src/ui/scoring-facility-artifacts_cb.cc
+++ b/src/ui/scoring-facility-artifacts_cb.cc
@@ -59,6 +59,10 @@ bSFADApply_clicked_cb( GtkButton*, gpointer userdata)
 
 	gtk_widget_hide( (GtkWidget*)SF.wSFArtifactDetectionSetup);
 
+	for ( auto& H : SF.channels_visible_backup )
+		H.first->hidden = H.second;
+	SF.channels_visible_backup.clear();
+
 	SF.artifacts_backup.clear_all();
 }
 
@@ -76,6 +80,11 @@ bSFADCancel_clicked_cb( GtkButton*, gpointer userdata)
 		gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 		gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
 	}
+
+	for ( auto& H : SF.channels_visible_backup )
+		H.first->hidden = H.second;
+	SF.channels_visible_backup.clear();
+
 	SF.artifacts_backup.clear_all();
 }
 
@@ -92,12 +101,27 @@ bSFADPreview_toggled_cb( GtkToggleButton *b, gpointer userdata)
 		SF.using_channel -> detect_artifacts(
 			SF.get_mc_params_from_SFAD_widgets());
 		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFADApply, TRUE);
+
+		if ( gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFADSingleChannelPreview) ) {
+			SF.channels_visible_backup.clear();
+			for ( auto& H : SF.channels ) {
+				SF.channels_visible_backup.emplace_back(
+					&H, H.hidden);
+				if ( &H != SF.using_channel )
+					H.hidden = true;
+			}
+		}  else
+			SF.channels_visible_backup.clear();
+
 	} else {
 		SF.using_channel->artifacts = SF.artifacts_backup;
+		for ( auto& H : SF.channels_visible_backup )
+			H.first->hidden = H.second;
 		gtk_widget_set_sensitive( (GtkWidget*)SF.bSFADApply, FALSE);
 	}
 
 	SF.using_channel -> get_signal_filtered();
+
 	gtk_widget_queue_draw( (GtkWidget*)SF.daSFMontage);
 	gtk_widget_queue_draw( (GtkWidget*)SF.daSFHypnogram);
 }
diff --git a/src/ui/scoring-facility-channel.cc b/src/ui/scoring-facility-channel.cc
index bdbac83..23e794b 100644
--- a/src/ui/scoring-facility-channel.cc
+++ b/src/ui/scoring-facility-channel.cc
@@ -342,9 +342,6 @@ void
 aghui::SScoringFacility::SChannel::
 detect_artifacts( SDetectArtifactsParams P)
 {
-	if ( P.pre_clear )
-		crecording.F().artifacts(_h).clear_all();
-
 	auto	sssu =
 		sigfile::CBinnedMC::do_sssu_reduction(
 			signal_original,
diff --git a/src/ui/scoring-facility-construct.cc b/src/ui/scoring-facility-construct.cc
index 7083dac..0d962ba 100644
--- a/src/ui/scoring-facility-construct.cc
+++ b/src/ui/scoring-facility-construct.cc
@@ -244,7 +244,7 @@ SScoringFacilityWidgets (SExpDesignUI& _p)
 	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADHistRangeMax)) ||
 	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADHistBins)) ||
 	     !(AGH_GBGETOBJ (GtkSpinButton,		eSFADSmoothSide)) ||
-	     !(AGH_GBGETOBJ (GtkCheckButton,		eSFADClearOldArtifacts)) ||
+	     !(AGH_GBGETOBJ (GtkCheckButton,		eSFADSingleChannelPreview)) ||
 	     !(AGH_GBGETOBJ (GtkCheckButton,		eSFADEstimateE)) ||
 	     !(AGH_GBGETOBJ (GtkRadioButton,		eSFADUseThisRange)) ||
 	     !(AGH_GBGETOBJ (GtkRadioButton,		eSFADUseComputedRange)) ||
diff --git a/src/ui/scoring-facility-widgets.hh b/src/ui/scoring-facility-widgets.hh
index 9abc5c7..969d20f 100644
--- a/src/ui/scoring-facility-widgets.hh
+++ b/src/ui/scoring-facility-widgets.hh
@@ -262,8 +262,8 @@ struct SScoringFacilityWidgets {
 		*eSFADHistBins,
 		*eSFADSmoothSide;
 	GtkCheckButton
-		*eSFADClearOldArtifacts,
-		*eSFADEstimateE;
+		*eSFADEstimateE,
+		*eSFADSingleChannelPreview;
 	GtkRadioButton
 		*eSFADUseThisRange,
 		*eSFADUseComputedRange;
diff --git a/src/ui/scoring-facility.cc b/src/ui/scoring-facility.cc
index 83e0219..442d783 100644
--- a/src/ui/scoring-facility.cc
+++ b/src/ui/scoring-facility.cc
@@ -492,13 +492,16 @@ marquee_to_selection()
 
 bool
 aghui::SScoringFacility::
-page_has_artifacts( size_t p) const
+page_has_artifacts( size_t p, bool search_all) const
 {
-	for ( auto &H : channels ) {
-		size_t spp = vpagesize() * H.samplerate();
-		if ( ((agh::alg::SSpan<size_t> (p, p+1)) * spp) . dirty( H.artifacts()) > 0. )
-			return true;
-	}
+	for ( auto &H : channels )
+		if ( ! search_all && H.hidden )
+			continue;
+		else {
+			size_t spp = vpagesize() * H.samplerate();
+			if ( ((agh::alg::SSpan<size_t> (p, p+1)) * spp) . dirty( H.artifacts()) > 0. )
+				return true;
+		}
 	return false;
 }
 
diff --git a/src/ui/scoring-facility.hh b/src/ui/scoring-facility.hh
index 5549fb9..2aa0968 100644
--- a/src/ui/scoring-facility.hh
+++ b/src/ui/scoring-facility.hh
@@ -112,8 +112,7 @@ class SScoringFacility
 			float	E, dmin, dmax;
 			size_t	sssu_hist_size,
 				smooth_side;
-			bool	pre_clear:1,
-				use_range:1;
+			bool	use_range:1;
 		};
 		void detect_artifacts( SDetectArtifactsParams);
 
@@ -386,7 +385,7 @@ class SScoringFacility
 		{
 			return sigfile::SPage::char2score( hypnogram[_cur_page]);
 		}
-	bool page_has_artifacts( size_t) const;
+	bool page_has_artifacts( size_t, bool check_all_channels = true) const;
 
       // pagesize
 	size_t pagesize() const
@@ -628,6 +627,7 @@ class SScoringFacility
 	SChannel::SDetectArtifactsParams
 	get_mc_params_from_SFAD_widgets() const;
 	sigfile::SArtifacts artifacts_backup;
+	list<pair<SChannel*, bool>> channels_visible_backup;
 	bool suppress_preview_handler;
 
       // menu support
diff --git a/src/ui/scoring-facility_cb.cc b/src/ui/scoring-facility_cb.cc
index 64001f2..db78c9e 100644
--- a/src/ui/scoring-facility_cb.cc
+++ b/src/ui/scoring-facility_cb.cc
@@ -153,7 +153,7 @@ bScoreGotoPrevArtifact_clicked_cb( GtkButton *button, gpointer userdata)
 		return;
 	size_t p = SF.cur_vpage();
 	while ( --p != (size_t)-1 )
-		if ( SF.page_has_artifacts( p)) {
+		if ( SF.page_has_artifacts( p, false)) {
 			gtk_statusbar_pop(  SF.sbSF, SF.sbSFContextIdGeneral);
 			SF.set_cur_vpage( p);
 			return;

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list