[med-svn] [SCM] aghermann branch, master, updated. 551e213a23b59b71cba6a9c3a282d1b60e21b854
Andrei Zavada
johnhommer at gmail.com
Sun Apr 21 23:18:20 UTC 2013
The following commit has been merged in the master branch:
commit c3c5c7940ba6e9e7bba5842d5e7ec4640bdb6596
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Mon Apr 22 01:28:26 2013 +0300
properly collect recording-wide annotations from all channel sources on SF
also fix var names after code copypaste in sf/montage.cc
diff --git a/src/ui/sf/montage.cc b/src/ui/sf/montage.cc
index 3629956..a83c6bb 100644
--- a/src/ui/sf/montage.cc
+++ b/src/ui/sf/montage.cc
@@ -714,9 +714,9 @@ void
aghui::SScoringFacility::
draw_montage( cairo_t* cr)
{
- double true_frac = 1. - 1. / (1. + 2*skirting_run_per1);
- size_t half_pad = da_wd * true_frac/2,
- ef = da_wd * (1. - true_frac); // w + 10% = d
+ double true_frac = 1. - 1. / (1. + 2*skirting_run_per1),
+ half_pad = pagesize() * skirting_run_per1;
+ size_t ef = da_wd * (1. - true_frac); // w + 10% = d
using namespace sigfile;
switch ( mode ) {
@@ -760,41 +760,42 @@ draw_montage( cairo_t* cr)
}
// recording-wide annotations
if ( not common_annotations.empty() ) {
- double last_z = 0;
- int overlap_count = 0;
- for ( auto &A : common_annotations ) {
+ for ( auto &SA : common_annotations ) {
+ auto &S = *SA.first;
+ auto &A = *SA.second;
+ double cvpa = cur_xvpage_start() - S.start_time(),
+ cvpe = cur_xvpage_end() - S.start_time(),
+ evpz = cvpe - cvpa;
+ double last_z = 0;
+ int overlap_count = 0;
if ( agh::alg::overlap( A.span.a, A.span.z, cvpa, cvpe) ) {
double aa = A.span.a - cvpa,
ae = A.span.z - cvpa;
agh::alg::ensure_within( aa, -half_pad, -half_pad + evpz);
agh::alg::ensure_within( ae, -half_pad, -half_pad + evpz);
- auto wa = fmod(aa, evpz) / evpz * wd,
- ww = (ae - aa) / evpz * wd;
+ auto wa = fmod(aa, evpz) / evpz * da_wd,
+ ww = (ae - aa) / evpz * da_wd;
if ( A.type == sigfile::SAnnotation::TType::plain ) {
- int disp = ptop +
+ int disp = 0 +
((last_z > A.span.a)
? ++overlap_count * 5
: (overlap_count = 0));
last_z = A.span.z;
- _p.CwB[SExpDesignUI::TColour::sf_annotations].pattern_add_color_stop_rgba( cp, 1., 0.);
- cairo_set_source( cr, );
+ _p.CwB[SExpDesignUI::TColour::sf_annotations].set_source_rgba( cr);
- cairo_rectangle( cr, wa, disp, ww, 0-ht);
+ cairo_rectangle( cr, wa, 0, ww, da_ht);
cairo_fill( cr);
cairo_stroke( cr);
- cairo_pattern_destroy( cp);
cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size( cr, 11);
cairo_set_source_rgb( cr, 0., 0., 0.);
- cairo_move_to( cr, fmod(aa, evpz) / evpz * wd, disp + 12);
+ cairo_move_to( cr, fmod(aa, evpz) / evpz * da_wd, da_ht - 12 - disp);
cairo_show_text( cr, A.label.c_str());
-
}
-
}
}
}
diff --git a/src/ui/sf/sf.cc b/src/ui/sf/sf.cc
index 8588f7f..da00416 100644
--- a/src/ui/sf/sf.cc
+++ b/src/ui/sf/sf.cc
@@ -137,6 +137,15 @@ SScoringFacility (agh::CSubject& J,
if ( channels.empty() )
throw invalid_argument( string ("No channels found for combination (") + J.id + ", " + D + ", " + E + ")");
+ // collect common annotations
+ for ( auto& H : channels )
+ for ( auto& A : H.crecording.F().annotations() )
+ common_annotations.push_back( {&H.crecording.F(), &A}); // bitch&
+ sort( common_annotations.begin(), common_annotations.end(),
+ []( const pair<const sigfile::CSource*, const sigfile::SAnnotation*>& a1,
+ const pair<const sigfile::CSource*, const sigfile::SAnnotation*>& a2)
+ { return *a1.second < *a2.second; });
+
// count n_eeg_channels
n_eeg_channels =
count_if( channels.begin(), channels.end(),
diff --git a/src/ui/sf/sf.hh b/src/ui/sf/sf.hh
index 54f986b..a7880ba 100644
--- a/src/ui/sf/sf.hh
+++ b/src/ui/sf/sf.hh
@@ -313,8 +313,8 @@ class SScoringFacility
void
update_all_channels_profile_display_scale();
- // common annotations
- list<sigfile::SAnnotation>
+ // collected common annotations
+ vector<pair<const sigfile::CSource*, const sigfile::SAnnotation*>>
common_annotations;
// timeline
--
Sleep experiment manager
More information about the debian-med-commit
mailing list