[med-svn] [SCM] aghermann branch, master, updated. 551e213a23b59b71cba6a9c3a282d1b60e21b854
Andrei Zavada
johnhommer at gmail.com
Sun Apr 21 23:18:08 UTC 2013
The following commit has been merged in the master branch:
commit 9013a20c369fb15d67f619b9487290f113de7b72
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Thu Apr 18 23:51:23 2013 +0300
make all annotations non-templated, all using SSpan<double>
diff --git a/src/expdesign/primaries.hh b/src/expdesign/primaries.hh
index 9881ee5..85e416b 100644
--- a/src/expdesign/primaries.hh
+++ b/src/expdesign/primaries.hh
@@ -137,12 +137,12 @@ class CSubject : public SSubjectId {
}
struct SAnnotation
- : public sigfile::SAnnotation<double> {
+ : public sigfile::SAnnotation {
const sigfile::CSource& _source;
int _h;
SAnnotation( const sigfile::CSource& _si, int _hi,
- const sigfile::SAnnotation<double>& _a)
- : sigfile::SAnnotation<double> (_a),
+ const sigfile::SAnnotation& _a)
+ : sigfile::SAnnotation (_a),
_source (_si), _h (_hi)
{}
SAnnotation( const SAnnotation&) = default;
diff --git a/src/libsigfile/edf.cc b/src/libsigfile/edf.cc
index f59c753..78ef950 100644
--- a/src/libsigfile/edf.cc
+++ b/src/libsigfile/edf.cc
@@ -217,11 +217,11 @@ CEDFFile (const string& fname_, int flags_)
getline( fd, an, EOA);
if ( isfinite(aa) and isfinite(az) and
aa < az and az < n_data_records * data_record_size
- and type < SAnnotation<size_t>::TType_total and type >= 0 )
+ and type < SAnnotation::TType_total and type >= 0 )
H.annotations.emplace_back(
aa, az,
trim(an),
- (SAnnotation<double>::TType)type);
+ (SAnnotation::TType)type);
else {
fprintf( stderr, "Bad annotation: (%d %g %g %50s)\n", type, aa, az, an.c_str());
break;
@@ -874,7 +874,7 @@ _extract_embedded_annotations()
record_start + offset,
record_start + offset + duration,
t,
- SAnnotation<double>::TType::plain);
+ SAnnotation::TType::plain);
}
}
diff --git a/src/libsigfile/edf.hh b/src/libsigfile/edf.hh
index c893aa7..febcb2c 100644
--- a/src/libsigfile/edf.hh
+++ b/src/libsigfile/edf.hh
@@ -171,23 +171,23 @@ class CEDFFile
samplerate( const string& h) const
{ return (*this)[h].samples_per_record / data_record_size; }
- list<SAnnotation<double>>&
+ list<SAnnotation>&
annotations( int h)
{ return (*this)[h].annotations; }
- list<SAnnotation<double>>&
+ list<SAnnotation>&
annotations( const string& h)
{ return (*this)[h].annotations; }
- const list<SAnnotation<double>>&
+ const list<SAnnotation>&
annotations( int h) const
{ return (*this)[h].annotations; }
- const list<SAnnotation<double>>&
+ const list<SAnnotation>&
annotations( const string& h) const
{ return (*this)[h].annotations; }
- list<SAnnotation<double>>&
+ list<SAnnotation>&
annotations()
{ return common_annotations; }
- const list<SAnnotation<double>>&
+ const list<SAnnotation>&
annotations() const
{ return common_annotations; }
@@ -453,7 +453,7 @@ class CEDFFile
return label == h;
}
- list<SAnnotation<double>>
+ list<SAnnotation>
annotations;
SArtifacts
artifacts;
@@ -467,7 +467,7 @@ class CEDFFile
channels;
static size_t max_channels;
- list<SAnnotation<double>> // timepoints in seconds
+ list<SAnnotation> // timepoints in seconds
common_annotations;
// signal accessors
diff --git a/src/libsigfile/source-base.hh b/src/libsigfile/source-base.hh
index 66eefca..072ace8 100644
--- a/src/libsigfile/source-base.hh
+++ b/src/libsigfile/source-base.hh
@@ -113,9 +113,8 @@ struct SArtifacts {
-template <typename T>
struct SAnnotation {
- agh::alg::SSpan<T> span;
+ agh::alg::SSpan<double> span;
string label;
enum TType {
plain,
@@ -126,7 +125,7 @@ struct SAnnotation {
};
TType type;
- SAnnotation( T aa, T az, const string& l, TType t = TType::plain)
+ SAnnotation( double aa, double az, const string& l, TType t = TType::plain)
: span {aa, az},
label (l),
type (t)
@@ -142,12 +141,14 @@ struct SAnnotation {
}
};
-template <typename T>
+
+
+
inline void
-mark_annotation( list<SAnnotation<T>>& annotations,
- T aa, T az,
+mark_annotation( list<SAnnotation>& annotations,
+ double aa, double az,
const string& label,
- sigfile::SAnnotation<double>::TType t = SAnnotation<T>::TType::plain)
+ SAnnotation::TType t = SAnnotation::TType::plain)
{
annotations.emplace_back( aa, az, label, t);
annotations.sort();
@@ -254,19 +255,19 @@ class CSource {
// the following methods are pass-through:
// 1. annotations
// (a) per-channel
- virtual list<SAnnotation<double>>&
+ virtual list<SAnnotation>&
annotations( const string&) = 0;
- virtual const list<SAnnotation<double>>&
+ virtual const list<SAnnotation>&
annotations( const string&) const = 0;
- virtual list<SAnnotation<double>>&
+ virtual list<SAnnotation>&
annotations( int) = 0;
- virtual const list<SAnnotation<double>>&
+ virtual const list<SAnnotation>&
annotations( int) const = 0;
// (b) common
- virtual list<SAnnotation<double>>&
+ virtual list<SAnnotation>&
annotations() = 0;
- virtual const list<SAnnotation<double>>&
+ virtual const list<SAnnotation>&
annotations() const = 0;
// artifacts
diff --git a/src/ui/mw/populate.cc b/src/ui/mw/populate.cc
index adfc6df..2fdca87 100644
--- a/src/ui/mw/populate.cc
+++ b/src/ui/mw/populate.cc
@@ -258,7 +258,7 @@ __reconnect_sessions_combo()
namespace {
const char*
-annotation_type_s( sigfile::SAnnotation<double>::TType t)
+annotation_type_s( sigfile::SAnnotation::TType t)
{
static const char* types[] = {"", "S", "K", "E"};
return types[t];
@@ -318,7 +318,7 @@ populate_mGlobalAnnotations()
for ( auto &A : annotations )
if ( (only_plain_global_annotations and
- A.type == sigfile::SAnnotation<double>::plain) or
+ A.type == sigfile::SAnnotation::plain) or
not only_plain_global_annotations ) {
global_annotations.emplace_front( J, D.first, E, A);
diff --git a/src/ui/sf/channel.cc b/src/ui/sf/channel.cc
index 978dd5d..c249d96 100644
--- a/src/ui/sf/channel.cc
+++ b/src/ui/sf/channel.cc
@@ -188,13 +188,13 @@ get_signal_filtered()
-list<sigfile::SAnnotation<double>*>
+list<sigfile::SAnnotation*>
aghui::SScoringFacility::SChannel::
in_annotations( double time) const
{
// select this channel's annotations
auto& annotations = crecording.F().annotations(name);
- list<sigfile::SAnnotation<double>*>
+ list<sigfile::SAnnotation*>
ret;
for ( auto &A : annotations )
if ( agh::alg::overlap(
@@ -482,7 +482,7 @@ mark_region_as_artifact( bool do_mark)
void
aghui::SScoringFacility::SChannel::
-mark_region_as_annotation( const string& label, sigfile::SAnnotation<double>::TType type)
+mark_region_as_annotation( const string& label, sigfile::SAnnotation::TType type)
{
sigfile::mark_annotation(
crecording.F().annotations(_h),
diff --git a/src/ui/sf/d/patterns.cc b/src/ui/sf/d/patterns.cc
index 7471588..01532ea 100644
--- a/src/ui/sf/d/patterns.cc
+++ b/src/ui/sf/d/patterns.cc
@@ -132,7 +132,7 @@ find_occurrences()
void
aghui::SScoringFacility::SPatternsDialog::
-occurrences_to_annotations( sigfile::SAnnotation<double>::TType t)
+occurrences_to_annotations( sigfile::SAnnotation::TType t)
{
for ( size_t o = 0; o < occurrences.size(); ++o )
sigfile::mark_annotation(
diff --git a/src/ui/sf/d/patterns.hh b/src/ui/sf/d/patterns.hh
index 22cc407..d7669bf 100644
--- a/src/ui/sf/d/patterns.hh
+++ b/src/ui/sf/d/patterns.hh
@@ -141,9 +141,9 @@ struct SScoringFacility::SPatternsDialog
SScoringFacility::SChannel
*field_channel,
*field_channel_saved;
- list<sigfile::SAnnotation<double>>
+ list<sigfile::SAnnotation>
saved_annotations;
- void occurrences_to_annotations( sigfile::SAnnotation<double>::TType = sigfile::SAnnotation<double>::TType::plain);
+ void occurrences_to_annotations( sigfile::SAnnotation::TType = sigfile::SAnnotation::TType::plain);
void save_annotations();
void restore_annotations();
diff --git a/src/ui/sf/d/patterns_cb.cc b/src/ui/sf/d/patterns_cb.cc
index 85709ce..354668f 100644
--- a/src/ui/sf/d/patterns_cb.cc
+++ b/src/ui/sf/d/patterns_cb.cc
@@ -266,7 +266,7 @@ iSFFDMarkPhasicEventSpindles_activate_cb( GtkMenuItem*, gpointer userdata)
auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
FD.restore_annotations();
- FD.occurrences_to_annotations( sigfile::SAnnotation<double>::TType::phasic_event_spindle);
+ FD.occurrences_to_annotations( sigfile::SAnnotation::TType::phasic_event_spindle);
FD.occurrences.clear();
FD._p.queue_redraw_all();
@@ -279,7 +279,7 @@ iSFFDMarkPhasicEventKComplexes_activate_cb( GtkMenuItem*, gpointer userdata)
auto& FD = *(SScoringFacility::SPatternsDialog*)userdata;
FD.restore_annotations();
- FD.occurrences_to_annotations( sigfile::SAnnotation<double>::TType::phasic_event_K_complex);
+ FD.occurrences_to_annotations( sigfile::SAnnotation::TType::phasic_event_K_complex);
FD.occurrences.clear();
FD._p.queue_redraw_all();
diff --git a/src/ui/sf/montage-overlays.cc b/src/ui/sf/montage-overlays.cc
index 5dd6d40..d02a2d6 100644
--- a/src/ui/sf/montage-overlays.cc
+++ b/src/ui/sf/montage-overlays.cc
@@ -268,7 +268,7 @@ draw_overlays( cairo_t* cr,
_p._p.CwB[SExpDesignUI::TColour::sf_phasic_spindle].set_source_rgba( cr);
cairo_set_line_width( cr, 1);
for ( auto& A : annotations )
- if ( A.type == sigfile::SAnnotation<double>::TType::phasic_event_spindle ) {
+ if ( A.type == sigfile::SAnnotation::TType::phasic_event_spindle ) {
auto x = (double)(A.span.z + A.span.a)/2 / samplerate()
/ ((double)_p.total_pages() * _p.pagesize());
cairo_move_to( cr, x * _p.da_wd - 2, pbot - 8);
@@ -285,7 +285,7 @@ draw_overlays( cairo_t* cr,
_p._p.CwB[SExpDesignUI::TColour::sf_phasic_Kcomplex].set_source_rgba( cr);
cairo_set_line_width( cr, 8);
for ( auto& A : annotations )
- if ( A.type == sigfile::SAnnotation<double>::TType::phasic_event_K_complex ) {
+ if ( A.type == sigfile::SAnnotation::TType::phasic_event_K_complex ) {
auto x = (float)(A.span.z + A.span.a)/2 / samplerate()
/ ((float)_p.total_pages() * _p.pagesize());
cairo_move_to( cr, x * _p.da_wd - 1, pbot - ptop - 8);
diff --git a/src/ui/sf/montage.cc b/src/ui/sf/montage.cc
index 8b6051e..aafd596 100644
--- a/src/ui/sf/montage.cc
+++ b/src/ui/sf/montage.cc
@@ -68,7 +68,7 @@ struct SChHolder {
-sigfile::SAnnotation<double>*
+sigfile::SAnnotation*
aghui::SScoringFacility::
interactively_choose_annotation() const
{
@@ -491,7 +491,7 @@ draw_page( cairo_t *cr,
auto wa = fmod(aa, evpz) / evpz * wd,
ww = (ae - aa) / evpz * wd;
- if ( A.type == sigfile::SAnnotation<double>::TType::plain ) {
+ if ( A.type == sigfile::SAnnotation::TType::plain ) {
int disp = ptop +
((last_z > A.span.a)
? ++overlap_count * 5
@@ -514,7 +514,7 @@ draw_page( cairo_t *cr,
cairo_move_to( cr, fmod(aa, evpz) / evpz * wd, disp + 12);
cairo_show_text( cr, A.label.c_str());
- } else if ( A.type == sigfile::SAnnotation<double>::TType::phasic_event_spindle
+ } else if ( A.type == sigfile::SAnnotation::TType::phasic_event_spindle
and draw_phasic_spindle ) {
cairo_pattern_t *cp = cairo_pattern_create_linear( wa, 0., wa + ww, 0.);
_p._p.CwB[SExpDesignUI::TColour::sf_phasic_spindle].pattern_add_color_stop_rgba( cp, 0., 0.);
@@ -527,7 +527,7 @@ draw_page( cairo_t *cr,
cairo_stroke( cr);
cairo_pattern_destroy( cp);
- } else if ( A.type == sigfile::SAnnotation<double>::TType::phasic_event_K_complex
+ } else if ( A.type == sigfile::SAnnotation::TType::phasic_event_K_complex
and draw_phasic_Kcomplex ) {
cairo_pattern_t *cp = cairo_pattern_create_linear( 0., ptop, 0., pbot);
_p._p.CwB[SExpDesignUI::TColour::sf_phasic_Kcomplex].pattern_add_color_stop_rgba( cp, 0., 0.);
@@ -540,7 +540,7 @@ draw_page( cairo_t *cr,
cairo_stroke( cr);
cairo_pattern_destroy( cp);
- } else if ( A.type == sigfile::SAnnotation<double>::TType::eyeblink
+ } else if ( A.type == sigfile::SAnnotation::TType::eyeblink
and draw_phasic_eyeblink ) {
cairo_pattern_t *cp = cairo_pattern_create_linear( 0., ptop, 0., pbot);
_p._p.CwB[SExpDesignUI::TColour::sf_phasic_eyeblink].pattern_add_color_stop_rgba( cp, 0., 0.);
diff --git a/src/ui/sf/montage_cb.cc b/src/ui/sf/montage_cb.cc
index 182803d..ef78cdc 100644
--- a/src/ui/sf/montage_cb.cc
+++ b/src/ui/sf/montage_cb.cc
@@ -849,7 +849,7 @@ void
iSFPageAnnotationEdit_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
{
auto& SF = *(SScoringFacility*)userdata;
- sigfile::SAnnotation<double> *which =
+ sigfile::SAnnotation *which =
(SF.over_annotations.size() == 1)
? SF.over_annotations.front()
: SF.interactively_choose_annotation();
@@ -858,16 +858,16 @@ iSFPageAnnotationEdit_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
gtk_entry_set_text( SF.eSFAnnotationLabel, which->label.c_str());
switch ( which->type ) {
- case sigfile::SAnnotation<double>::TType::phasic_event_spindle:
+ case sigfile::SAnnotation::TType::phasic_event_spindle:
gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypeSpindle, TRUE);
break;
- case sigfile::SAnnotation<double>::TType::phasic_event_K_complex:
+ case sigfile::SAnnotation::TType::phasic_event_K_complex:
gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypeKComplex, TRUE);
break;
- case sigfile::SAnnotation<double>::TType::eyeblink:
+ case sigfile::SAnnotation::TType::eyeblink:
gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypeBlink, TRUE);
break;
- case sigfile::SAnnotation<double>::TType::plain:
+ case sigfile::SAnnotation::TType::plain:
default:
gtk_toggle_button_set_active( (GtkToggleButton*)SF.eSFAnnotationTypePlain, TRUE);
break;
@@ -878,12 +878,12 @@ iSFPageAnnotationEdit_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
const char* new_label = gtk_entry_get_text( SF.eSFAnnotationLabel);
auto new_type =
gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeSpindle)
- ? sigfile::SAnnotation<double>::TType::phasic_event_spindle
+ ? sigfile::SAnnotation::TType::phasic_event_spindle
: gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeKComplex)
- ? sigfile::SAnnotation<double>::TType::phasic_event_K_complex
+ ? sigfile::SAnnotation::TType::phasic_event_K_complex
: gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeBlink)
- ? sigfile::SAnnotation<double>::TType::eyeblink
- : sigfile::SAnnotation<double>::TType::plain;
+ ? sigfile::SAnnotation::TType::eyeblink
+ : sigfile::SAnnotation::TType::plain;
if ( strlen(new_label) > 0 ) {
which->label = new_label;
@@ -1031,12 +1031,12 @@ iSFPageSelectionAnnotate_activate_cb( GtkMenuItem *menuitem, gpointer userdata)
auto type =
gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeSpindle)
- ? sigfile::SAnnotation<double>::TType::phasic_event_spindle
+ ? sigfile::SAnnotation::TType::phasic_event_spindle
: gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeKComplex)
- ? sigfile::SAnnotation<double>::TType::phasic_event_K_complex
+ ? sigfile::SAnnotation::TType::phasic_event_K_complex
: gtk_toggle_button_get_active( (GtkToggleButton*)SF.eSFAnnotationTypeBlink)
- ? sigfile::SAnnotation<double>::TType::eyeblink
- : sigfile::SAnnotation<double>::TType::plain;
+ ? sigfile::SAnnotation::TType::eyeblink
+ : sigfile::SAnnotation::TType::plain;
SF.using_channel->mark_region_as_annotation( new_ann, type);
diff --git a/src/ui/sf/sf.hh b/src/ui/sf/sf.hh
index ede128b..54f986b 100644
--- a/src/ui/sf/sf.hh
+++ b/src/ui/sf/sf.hh
@@ -83,7 +83,7 @@ class SScoringFacility
int _h;
sigfile::SFilterPack&
filters;
- list<sigfile::SAnnotation<double>>&
+ list<sigfile::SAnnotation>&
annotations;
sigfile::SArtifacts&
artifacts;
@@ -114,7 +114,7 @@ class SScoringFacility
mark_flat_regions_as_artifacts( double at_least_this_long, double pad);
// annotations
- list<sigfile::SAnnotation<double>*>
+ list<sigfile::SAnnotation*>
in_annotations( double time) const;
// signal metrics
@@ -199,7 +199,7 @@ class SScoringFacility
// region
void mark_region_as_artifact( bool do_mark);
- void mark_region_as_annotation( const string&, sigfile::SAnnotation<double>::TType);
+ void mark_region_as_annotation( const string&, sigfile::SAnnotation::TType);
void mark_region_as_pattern();
// ctor, dtor
@@ -314,7 +314,7 @@ class SScoringFacility
update_all_channels_profile_display_scale();
// common annotations
- list<sigfile::SAnnotation<double>>
+ list<sigfile::SAnnotation>
common_annotations;
// timeline
@@ -550,9 +550,9 @@ class SScoringFacility
else ++i;
return -1;
}
- list<sigfile::SAnnotation<double>*>
+ list<sigfile::SAnnotation*>
over_annotations;
- sigfile::SAnnotation<double>*
+ sigfile::SAnnotation*
interactively_choose_annotation() const;
private:
--
Sleep experiment manager
More information about the debian-med-commit
mailing list