[med-svn] [SCM] aghermann branch, master, updated. c0bd21ca8eb529ade7e0c7aad22951a308a8dc8f
Andrei Zavada
johnhommer at gmail.com
Wed May 1 00:09:43 UTC 2013
The following commit has been merged in the master branch:
commit 9897b3a5dca35d668820513631b2fe9b37c33642
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Mon Apr 29 18:34:58 2013 +0300
complete 7c9394f8 (propagate all sigfile::SChannel changes throughout)
diff --git a/src/expdesign/primaries.cc b/src/expdesign/primaries.cc
index dfcafbc..09c7f46 100644
--- a/src/expdesign/primaries.cc
+++ b/src/expdesign/primaries.cc
@@ -381,7 +381,7 @@ used_samplerates( sigfile::SChannel::TType type) const
for ( auto &E : D.second.episodes )
for ( auto &F : E.sources )
for ( size_t h = 0; h < F().n_channels(); ++h )
- if ( type == sigfile::SChannel::other or
+ if ( type == sigfile::SChannel::TType::other or
type == F().signal_type(h) ) {
recp.push_back( F().samplerate(h));
}
@@ -429,7 +429,7 @@ SEpisode (sigfile::CTypedSource&& F_,
auto& F = sources.back();
auto HH = F().channel_list();
printf( "CSubject::SEpisode::SEpisode( \"%s\"): %s\n",
- F().filename(), agh::str::join(HH, ", ").c_str());
+ F().filename(), sigfile::join_channel_names(HH, ", ").c_str());
int h = 0;
for ( auto& H : HH )
recordings.insert( {H, {F, h++, fft_params, swu_params, mc_params}});
diff --git a/src/expdesign/primaries.hh b/src/expdesign/primaries.hh
index e33f1cf..735eced 100644
--- a/src/expdesign/primaries.hh
+++ b/src/expdesign/primaries.hh
@@ -286,7 +286,7 @@ class CExpDesign {
public:
// constructor
- typedef function<void(const char*, size_t, size_t)> TMsmtCollectProgressIndicatorFun;
+ typedef function<void(const string&, size_t, size_t)> TMsmtCollectProgressIndicatorFun;
CExpDesign (const string& sessiondir,
TMsmtCollectProgressIndicatorFun progress_fun = progress_fun_stdout);
~CExpDesign ()
@@ -366,7 +366,7 @@ class CExpDesign {
static bool is_supported_source( sigfile::CTypedSource&);
// model runs
- int setup_modrun( const char* j, const char* d, const char* h,
+ int setup_modrun( const string& j, const string& d, const string& h,
const SProfileParamSet&,
ach::CModelRun**);
void remove_all_modruns();
@@ -382,7 +382,7 @@ class CExpDesign {
list<string> enumerate_episodes() const;
list<sigfile::SChannel> enumerate_all_channels() const;
list<sigfile::SChannel> enumerate_eeg_channels() const;
- vector<size_t> used_samplerates( sigfile::SChannel::TType type = sigfile::SChannel::other) const;
+ vector<size_t> used_samplerates( sigfile::SChannel::TType type = sigfile::SChannel::TType::other) const;
// omp-enabled lists:foreach
typedef function<void(CSubject&)>
diff --git a/src/expdesign/recording.cc b/src/expdesign/recording.cc
index 1fe7d29..3027ac1 100644
--- a/src/expdesign/recording.cc
+++ b/src/expdesign/recording.cc
@@ -30,12 +30,7 @@ CRecording (sigfile::CTypedSource& F, int sig_no,
uc_params (nullptr),
_status (0), // not computed
_source (F), _sig_no (sig_no)
-{
- // if ( F.signal_type(sig_no) == sigfile::SChannel::TType::eeg ) {
- // CBinnedPower::compute();
- // CBinnedMC::compute();
- // }
-}
+{}
agh::CRecording::
diff --git a/src/expdesign/tree-scanner.cc b/src/expdesign/tree-scanner.cc
index bd9634c..b9ba463 100644
--- a/src/expdesign/tree-scanner.cc
+++ b/src/expdesign/tree-scanner.cc
@@ -24,9 +24,9 @@ using namespace std;
namespace {
struct progress_fun_stdout_fo {
- void operator() ( const char* current, size_t n, size_t i) const
+ void operator() ( const string& current, size_t n, size_t i) const
{
- printf( "(%zu of %zu) %s\n", i, n, current);
+ printf( "(%zu of %zu) %s\n", i, n, current.c_str());
}
};
} // namespace
@@ -391,7 +391,7 @@ compute_profiles()
size_t i, size_t total)
{
only_progress_fun(
- (string ("Compute ") + R.F().filename() + ":"+R.F().channel_by_id(R.h())).c_str(),
+ string ("Compute ") + R.F().filename() + ":"+R.F().channel_by_id(R.h()).name(),
total, i);
};
TRecordingFilterFun filter =
diff --git a/src/libsigfile/channel.cc b/src/libsigfile/channel.cc
index c7c8e69..88e960b 100644
--- a/src/libsigfile/channel.cc
+++ b/src/libsigfile/channel.cc
@@ -107,6 +107,7 @@ template const char* SChannel::channel_s<SChannel::TType::erg>( int);
tuple<SChannel::TType, int>
+SChannel::
figure_type_and_name( const string& h)
{
for ( auto& T : _CT_ )
diff --git a/src/libsigfile/channel.hh b/src/libsigfile/channel.hh
index 9883cc4..e34281e 100644
--- a/src/libsigfile/channel.hh
+++ b/src/libsigfile/channel.hh
@@ -15,6 +15,7 @@
#include <cstring>
#include <tuple>
#include <string>
+#include <sstream>
#if HAVE_CONFIG_H && !defined(VERSION)
# include "config.h"
@@ -126,14 +127,21 @@ struct SChannel {
}
}
- template <TType T>
- SChannel (int idx_)
- : _type (T),
+ SChannel (TType type_, int idx_)
+ : _type (type_),
_idx (idx_)
{}
+ SChannel (TType type_, const string& custom_name_)
+ : _type (type_),
+ _idx (0),
+ _custom_name (custom_name_)
+ {}
+ SChannel () = default;
TType type() const
{ return _type; }
+ const char* type_s() const
+ { return type_s(_type); }
const char* name() const
{
@@ -146,15 +154,19 @@ struct SChannel {
default: return _custom_name.c_str();
}
}
+ const char* c_str() const
+ { return name(); }
+ int idx() const
+ { return _idx; }
- bool is_fftable()
+ bool is_fftable() const
{
return is_fftable( _type);
}
private:
- string _custom_name;
TType _type;
int _idx;
+ string _custom_name;
public:
// compares by channel actual locations, antero-posteriorly
@@ -180,6 +192,20 @@ struct SChannel {
}
};
+template <typename C>
+string
+join_channel_names( const C& l, const char* sep)
+{
+ if ( l.empty() )
+ return "";
+ ostringstream recv;
+ auto I = l.begin();
+ for ( ; next(I) != l.end(); ++I )
+ recv << I->name() << sep;
+ recv << I->name();
+ return recv.str();
+}
+
} // namespace sigfile
diff --git a/src/libsigfile/edf.cc b/src/libsigfile/edf.cc
index 6bf263d..8b566b3 100644
--- a/src/libsigfile/edf.cc
+++ b/src/libsigfile/edf.cc
@@ -129,14 +129,14 @@ CEDFFile (const string& fname_, const int flags_)
int stst = stat( fname_.c_str(), &stat0);
if ( stst == -1 ) {
_status |= TStatus::sysfail;
- throw runtime_error (explain_edf_status(_status));
+ throw invalid_argument (explain_edf_status(_status));
}
_fsize = stat0.st_size;
}
_fd = open( fname_.c_str(), O_RDWR);
if ( _fd == -1 ) {
_status |= TStatus::sysfail;
- throw runtime_error (explain_edf_status(_status));
+ throw invalid_argument (explain_edf_status(_status));
}
// mmap
@@ -155,7 +155,7 @@ CEDFFile (const string& fname_, const int flags_)
if ( not (flags_ & no_field_consistency_check) ) {
close( _fd);
munmap( _mmapping, _fsize);
- throw runtime_error (explain_edf_status(_status));
+ throw invalid_argument (explain_edf_status(_status));
} else
fprintf( stderr, "CEDFFile::CEDFFile(\"%s\") Warning: parse header failed, but proceeding anyway\n", fname_.c_str());
}
@@ -174,7 +174,7 @@ CEDFFile (const string& fname_, const int flags_)
close( _fd);
munmap( _mmapping, _fsize);
_status |= file_truncated;
- throw runtime_error (explain_edf_status(_status));
+ throw invalid_argument (explain_edf_status(_status));
} else if ( _fsize > expected_fsize ) {
_status |= trailing_junk;
fprintf( stderr, "CEDFFile::CEDFFile(\"%s\") Warning: %zu bytes of trailing junk\n",
@@ -533,8 +533,7 @@ int
CEDFFile::
_parse_header()
{
- size_t n_channels,
- i;
+ size_t n_channels;
try {
_fld_pos = 0;
_get_next_field( header.version_number, 8);
@@ -677,34 +676,30 @@ _parse_header()
// determine & validate signal types
for ( auto &H : channels ) {
_get_next_field( H.header.label, 16);
+ string isolated_label = trim( string (H.header.label, 16));
- if ( 0 == strcmp( H.header.label == sigfile::edf_annotations_label )
- H.ucd = sigfile::SChannel<sigfile::TType::embedded_annotation>(0);
+ if ( isolated_label == sigfile::edf_annotations_label )
+ H.ucd = sigfile::SChannel( sigfile::SChannel::TType::embedded_annotation, 0);
else {
- auto tt = agh::str::tokens( H.name, " ");
- SChannel::TType figured_type;
+ auto tt = agh::str::tokens( isolated_label, " ");
// parse legacy pre 0.9 specs ("EEG F3" etc)
- if ( tt.size() > 1 &&
- (figured_type = SChannel::figure_signal_type(tt.front().c_str()))
- != SChannel::TType::other ) {
- H.signal_type = figured_type;
- H.signal_type_s = tt.front();
- H.name = (tt.pop_front(), agh::str::join( tt, " "));
- if ( not H.name.follows_system1020() )
- _status |= non1020_channel;
+ if ( tt.size() > 1 ) {
+ string suggested_type = tt.front();
+ H.ucd = sigfile::SChannel ((tt.pop_front(), agh::str::join( tt, " ")));
+ if ( suggested_type == H.ucd.type_s() )
+ ; // all agree
+ else
+ _status |= recognised_channel_conflicting_type;
} else {
- H.signal_type_s = SChannel::kemp_signal_types[
- H.signal_type = SChannel::signal_type_of_channel( H.name) ];
+ H.ucd = sigfile::SChannel (isolated_label);
- if ( not H.label.follows_system1020() )
+ if ( H.ucd.type() == sigfile::SChannel::TType::eeg &&
+ H.ucd.idx() == sigfile::EEG::custom )
_status |= non1020_channel;
- if ( H.signal_type == SChannel::TType::other )
+ if ( H.ucd.type() == SChannel::SChannel::TType::other )
_status |= nonkemp_signaltype;
}
}
-
- H.ucd = trim( string (, 16));
- // includes figuring signal type and mapping to a canonicalised name
}
for ( auto &H : channels )
H.transducer_type =
@@ -813,7 +808,7 @@ _parse_header()
// are channels unique?
for ( auto &H : channels )
for ( auto &J : channels ) {
- if ( &J != &H && J.label == H.label ) {
+ if ( &J != &H && J.ucd == H.ucd ) {
_status |= dup_channels;
goto outer_break;
}
@@ -1040,6 +1035,8 @@ explain_edf_status( const int status)
recv.emplace_back( "* File has trailing junk");
if ( status & extra_patientid_subfields )
recv.emplace_back( "* Extra subfields in PatientId");
+ if ( status & recognised_channel_conflicting_type )
+ recv.emplace_back( "* Explicitly specified signal type does not match type of known channel name");
return join(recv, "\n");
}
diff --git a/src/libsigfile/edf.hh b/src/libsigfile/edf.hh
index 265986d..bc7db0c 100644
--- a/src/libsigfile/edf.hh
+++ b/src/libsigfile/edf.hh
@@ -447,6 +447,10 @@ class CEDFFile
{
return ucd.name() == h.name();
}
+ bool operator==( const string& h) const
+ {
+ return ucd.name() == h;
+ }
list<SAnnotation>
annotations;
@@ -513,6 +517,7 @@ class CEDFFile
file_truncated = (1 << 17),
trailing_junk = (1 << 18),
extra_patientid_subfields = (1 << 19),
+ recognised_channel_conflicting_type = (1 << 20),
inoperable = (bad_header
| bad_version
diff --git a/src/libsigfile/source-base.hh b/src/libsigfile/source-base.hh
index 5d9be26..fbde17a 100644
--- a/src/libsigfile/source-base.hh
+++ b/src/libsigfile/source-base.hh
@@ -277,11 +277,11 @@ class CSource {
// filters
virtual SFilterPack&
- filters( const SChannel&) = 0;
+ filters( const SChannel&) = 0;
virtual SFilterPack&
filters( int) = 0;
virtual const SFilterPack&
- filters( const SChannel&) const = 0;
+ filters( const SChannel&) const = 0;
virtual const SFilterPack&
filters( int) const = 0;
diff --git a/src/model/achermann.cc b/src/model/achermann.cc
index 056ebdf..c2eb6e9 100644
--- a/src/model/achermann.cc
+++ b/src/model/achermann.cc
@@ -72,7 +72,7 @@ operator==( const SControlParamSet &rv) const
int
agh::CExpDesign::
-setup_modrun( const char* j, const char* d, const char* h,
+setup_modrun( const string& j, const string& d, const string& h,
const SProfileParamSet& profile_params0,
agh::ach::CModelRun** Rpp)
{
@@ -99,13 +99,13 @@ setup_modrun( const char* j, const char* d, const char* h,
. modrun_sets[profile_params0][h];
} catch (invalid_argument ex) { // thrown by CProfile ctor
- fprintf( stderr, "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j, d, h, ex.what());
+ fprintf( stderr, "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j.c_str(), d.c_str(), h.c_str(), ex.what());
return -1;
} catch (out_of_range ex) {
- fprintf( stderr, "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j, d, h, ex.what());
+ fprintf( stderr, "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j.c_str(), d.c_str(), h.c_str(), ex.what());
return -1;
} catch (int ex) { // thrown by CModelRun ctor
- log_message( "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j, d, h, CProfile::explain_status(ex).c_str());
+ log_message( "CExpDesign::setup_modrun( %s, %s, %s): %s\n", j.c_str(), d.c_str(), h.c_str(), CProfile::explain_status(ex).c_str());
return ex;
}
diff --git a/src/tools/edfcat.cc b/src/tools/edfcat.cc
index 40fbdd4..8887b30 100644
--- a/src/tools/edfcat.cc
+++ b/src/tools/edfcat.cc
@@ -194,7 +194,7 @@ make_channel_headers_for_CEDFFile( size_t n, const char *fmt, size_t samplerate)
list<pair<sigfile::SChannel, size_t>> ret;
for ( size_t i = 0; i < n; ++i ) {
DEF_UNIQUE_CHARP (_);
- ret.emplace_back( (ASPRINTF( &_, fmt, i), _), samplerate);
+ ret.emplace_back( (ASPRINTF( &_, fmt, i), string (_)), samplerate);
}
return ret;
}
diff --git a/src/tools/edfhed.cc b/src/tools/edfhed.cc
index b027dd8..3dfc650 100644
--- a/src/tools/edfhed.cc
+++ b/src/tools/edfhed.cc
@@ -101,7 +101,8 @@ struct SSettable {
if ( 3 == sscanf( pv, "%u:%20[a-z_]:%80s", &h, p, v) && h != -1 ) {
channel = h - 1; // base 0
if ( strcmp( p, "label") == 0 ) {
- if ( not sigfile::SChannel::channel_follows_system1020( v) )
+ sigfile::SChannel X (p);
+ if ( X.type() != sigfile::SChannel::TType::eeg )
printf( "Note: Channel label \"%s\" does not follow System 10-20\n", v);
which = ch_label;
} else if ( strcmp( p, "transducer_type") == 0 ) {
diff --git a/src/ui/mw/mainmenu_cb.cc b/src/ui/mw/mainmenu_cb.cc
index 33ad2ae..1a4ea99 100644
--- a/src/ui/mw/mainmenu_cb.cc
+++ b/src/ui/mw/mainmenu_cb.cc
@@ -181,12 +181,12 @@ iExpBasicSADetectUltradianCycles_activate_cb(
CExpDesign::TEpisodeFilterFun filter =
[&ED]( agh::CSubject::SEpisode& E) -> bool
{
- return E.recordings.find( ED.AghH()) != E.recordings.end();
+ return E.recordings.find( *ED._AghHi) != E.recordings.end();
};
CExpDesign::TEpisodeOpFun F =
[&ED]( agh::CSubject::SEpisode& E)
{
- ED.do_detect_ultradian_cycle( E.recordings.at( ED.AghH()));
+ ED.do_detect_ultradian_cycle( E.recordings.at( *ED._AghHi));
};
CExpDesign::TEpisodeReportFun reporter =
[&ED]( const agh::CJGroup&, const agh::CSubject& J, const string&, const agh::CSubject::SEpisode& E,
@@ -253,7 +253,7 @@ iExpGloballyDetectArtifacts_activate_cb(
{
snprintf_buf(
"Detect artifacts in %s/%s/%s/%s:%s",
- ED.ED->group_of(J), J.id.c_str(), D.c_str(), E.name(), R.F().channel_by_id(R.h()));
+ ED.ED->group_of(J), J.id.c_str(), D.c_str(), E.name(), R.F().channel_by_id(R.h()).name());
ED.sb_main_progress_indicator( __buf__, total, i, TGtkRefreshMode::gtk);
};
switch ( response ) {
@@ -286,7 +286,7 @@ iExpGloballyDetectArtifacts_activate_cb(
{
auto& F = R.F();
for ( auto& H : F.channel_list() ) {
- auto& af = F.artifacts(H.c_str());
+ auto& af = F.artifacts(H);
af.clear_all();
}
};
@@ -363,7 +363,7 @@ iExpGloballySetFilters_activate_cb(
for ( auto &E : D.second.episodes )
for ( auto &F : E.sources )
for ( auto &H : F().channel_list() ) {
- auto& ff = F().filters(H.c_str());
+ auto& ff = F().filters(H);
ff.low_pass_cutoff = LPC;
ff.low_pass_order = LPO;
ff.high_pass_cutoff = HPC;
diff --git a/src/ui/mw/measurements.cc b/src/ui/mw/measurements.cc
index c1e54e0..137212c 100644
--- a/src/ui/mw/measurements.cc
+++ b/src/ui/mw/measurements.cc
@@ -218,7 +218,7 @@ draw_timeline( cairo_t *cr) const
// ultradian cycle
if ( _p._p.draw_nremrem_cycles ) {
- auto& M = E.recordings.at(_p._p.AghT());
+ auto& M = E.recordings.at(*_p._p._AghTi);
if ( M.have_uc_determined() ) {
agh::beersma::FUltradianCycle F (*M.uc_params);
snprintf_buf( "T: %g r: %g", F.T, F.r);
diff --git a/src/ui/mw/measurements_cb.cc b/src/ui/mw/measurements_cb.cc
index fc780a3..a07fcc5 100644
--- a/src/ui/mw/measurements_cb.cc
+++ b/src/ui/mw/measurements_cb.cc
@@ -178,7 +178,7 @@ iSubjectTimelineDetectUltradianCycle_activate_cb(
auto& ED = *(SExpDesignUI*)userdata;
agh::CSubject::SEpisode *Ep;
if ( ED.using_subject && (Ep = ED.using_subject->using_episode) ) {
- auto& R = Ep->recordings.at(ED.AghH());
+ auto& R = Ep->recordings.at(*ED._AghHi);
SBusyBlock bb (ED.wMainWindow);
ED.do_detect_ultradian_cycle( R);
}
diff --git a/src/ui/mw/mw.cc b/src/ui/mw/mw.cc
index 1e16ddf..087e397 100644
--- a/src/ui/mw/mw.cc
+++ b/src/ui/mw/mw.cc
@@ -588,12 +588,12 @@ sb_clear() const
void
aghui::SExpDesignUI::
-sb_main_progress_indicator( const char* current,
+sb_main_progress_indicator( const string& current,
const size_t n, const size_t i,
const aghui::TGtkRefreshMode mode)
{
DEF_UNIQUE_CHARP (b);
- ASPRINTF( &b, "(%zu of %zu) %s", i, n, current);
+ ASPRINTF( &b, "(%zu of %zu) %s", i, n, current.c_str());
sb_message( b);
switch ( mode ) {
diff --git a/src/ui/mw/mw.hh b/src/ui/mw/mw.hh
index 26e9914..2bb0524 100644
--- a/src/ui/mw/mw.hh
+++ b/src/ui/mw/mw.hh
@@ -178,8 +178,8 @@ class SExpDesignUI
_AghHi, _AghTi;
list<string>::iterator
_AghGi, _AghDi, _AghEi;
- const char* AghH() const { return (_AghHi != AghHH.end()) ? _AghHi->c_str() : "(invalid channel)"; }
- const char* AghT() const { return (_AghTi != AghTT.end()) ? _AghTi->c_str() : "(invalid channel)"; }
+ const char* AghH() const { return (_AghHi != AghHH.end()) ? _AghHi->name() : "(invalid channel)"; }
+ const char* AghT() const { return (_AghTi != AghTT.end()) ? _AghTi->name() : "(invalid channel)"; }
const char* AghG() const { return (_AghGi != AghGG.end()) ? _AghGi->c_str() : "(invalid group)"; }
const char* AghD() const { return (_AghDi != AghDD.end()) ? _AghDi->c_str() : "(invalid session)"; }
const char* AghE() const { return (_AghEi != AghEE.end()) ? _AghEi->c_str() : "(invalid episode)"; }
@@ -333,7 +333,7 @@ class SExpDesignUI
// status bar bits
void sb_message( const char*) const;
void sb_clear() const;
- void sb_main_progress_indicator( const char*, size_t n, size_t i,
+ void sb_main_progress_indicator( const string&, size_t n, size_t i,
aghui::TGtkRefreshMode);
// dnd
diff --git a/src/ui/mw/populate.cc b/src/ui/mw/populate.cc
index f156a29..43acff7 100644
--- a/src/ui/mw/populate.cc
+++ b/src/ui/mw/populate.cc
@@ -45,8 +45,8 @@ populate( bool do_load)
"* Episodes: %s\n",
agh::str::join( AghDD, "; ").c_str(),
agh::str::join( AghGG, "; ").c_str(),
- agh::str::join( AghHH, "; ").c_str(),
- agh::str::join( AghTT, "; ").c_str(),
+ sigfile::join_channel_names( AghHH, "; ").c_str(),
+ sigfile::join_channel_names( AghTT, "; ").c_str(),
agh::str::join( AghEE, "; ").c_str());
used_samplerates =
@@ -78,8 +78,9 @@ populate( bool do_load)
}
ED->last_used_version = VERSION;
- snprintf_buf( "Smooth: %zu", smooth_profile);
- gtk_button_set_label( (GtkButton*)eMsmtProfileSmooth, __buf__);
+ gtk_button_set_label(
+ (GtkButton*)eMsmtProfileSmooth,
+ (snprintf_buf( "Smooth: %zu", smooth_profile), __buf__));
if ( AghTT.empty() )
aghui::pop_ok_message( wMainWindow,
@@ -209,7 +210,7 @@ populate_mChannels()
GtkTreeIter iter;
gtk_list_store_append( mEEGChannels, &iter);
gtk_list_store_set( mEEGChannels, &iter,
- 0, H.c_str(),
+ 0, H.name(),
-1);
}
@@ -217,7 +218,7 @@ populate_mChannels()
GtkTreeIter iter;
gtk_list_store_append( mAllChannels, &iter);
gtk_list_store_set( mAllChannels, &iter,
- 0, H.c_str(),
+ 0, H.name(),
-1);
}
diff --git a/src/ui/mw/simulations_cb.cc b/src/ui/mw/simulations_cb.cc
index b0d4b80..2e23e2b 100644
--- a/src/ui/mw/simulations_cb.cc
+++ b/src/ui/mw/simulations_cb.cc
@@ -48,7 +48,7 @@ iSimulationsRunBatch_activate_cb(
gtk_entry_set_text( ED.eBatchSetupSubjects, agh::str::join( ED.ED->enumerate_subjects(), "; ").c_str());
gtk_entry_set_text( ED.eBatchSetupSessions, agh::str::join( ED.ED->enumerate_sessions(), "; ").c_str());
- gtk_entry_set_text( ED.eBatchSetupChannels, agh::str::join( ED.ED->enumerate_eeg_channels(), "; ").c_str());
+ gtk_entry_set_text( ED.eBatchSetupChannels, sigfile::join_channel_names( ED.ED->enumerate_eeg_channels(), "; ").c_str());
// prevent inapplicable inputs when type == mc
switch ( ED.display_profile_type ) {
diff --git a/src/ui/sf/channel.cc b/src/ui/sf/channel.cc
index ae9d237..e4ecbc3 100644
--- a/src/ui/sf/channel.cc
+++ b/src/ui/sf/channel.cc
@@ -33,7 +33,6 @@ SChannel (agh::CRecording& r,
size_t y0,
int seq)
: name (r.channel()),
- type (r.signal_type()),
crecording (r),
_h (r.F().channel_id(name)),
filters (r.F().filters(name)),
@@ -111,7 +110,7 @@ SChannel (agh::CRecording& r,
// get_raw_profile(); // too heavy; make it on-demand
// psd power and spectrum, mc
- if ( sigfile::SChannel::signal_type_is_fftable( type) ) {
+ if ( schannel().is_fftable() ) {
// power in a single bin
psd.from = _p._p.active_profile_psd_freq_from;
psd.upto = _p._p.active_profile_psd_freq_upto;
@@ -165,7 +164,7 @@ aghui::SScoringFacility::SChannel::
get_signal_original()
{
signal_original =
- crecording.F().get_signal_original( name);
+ crecording.F().get_signal_original( _h);
// signal_original_resampled =
// sigproc::resample( signal_original, 0, signal_original.size(),
// signal_original.size() / spp());
@@ -179,7 +178,7 @@ aghui::SScoringFacility::SChannel::
get_signal_filtered()
{
signal_filtered =
- crecording.F().get_signal_filtered( name);
+ crecording.F().get_signal_filtered( _h);
// filtered is already zeromean as shipped
drop_cached_signal_properties();
}
@@ -194,7 +193,7 @@ aghui::SScoringFacility::SChannel::
in_annotations( const double time) const
{
// select this channel's annotations
- auto& annotations = crecording.F().annotations(name);
+ auto& annotations = crecording.F().annotations(_h);
list<sigfile::SAnnotation*>
ret;
for ( auto &A : annotations )
diff --git a/src/ui/sf/d/patterns.cc b/src/ui/sf/d/patterns.cc
index 96965b9..f0b5993 100644
--- a/src/ui/sf/d/patterns.cc
+++ b/src/ui/sf/d/patterns.cc
@@ -274,7 +274,7 @@ update_field_check_menu_items()
suppress_redraw = true;
gtk_check_menu_item_set_active( iSFFDFieldDrawMatchIndex, draw_match_index);
- if ( not sigfile::SChannel::signal_type_is_fftable( field_channel->type) ) {
+ if ( not field_channel->schannel().is_fftable() ) {
field_profile_type = metrics::TType::raw;
gtk_widget_set_visible( (GtkWidget*)iiSFFDFieldProfileTypes, FALSE);
} else
diff --git a/src/ui/sf/montage.cc b/src/ui/sf/montage.cc
index 2008dcd..f796a1e 100644
--- a/src/ui/sf/montage.cc
+++ b/src/ui/sf/montage.cc
@@ -571,7 +571,7 @@ draw_page( cairo_t *cr,
{
int x = 15, y = y0 - 16;
- snprintf_buf( "[%s] %s", sigfile::SChannel::kemp_signal_types[type], name.c_str());
+ snprintf_buf( "[%s] %s", schannel().type_s(), schannel().name());
cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size( cr, 14);
diff --git a/src/ui/sf/sf.cc b/src/ui/sf/sf.cc
index 6d26dec..7a74c50 100644
--- a/src/ui/sf/sf.cc
+++ b/src/ui/sf/sf.cc
@@ -400,7 +400,7 @@ aghui::SScoringFacility::
update_all_channels_profile_display_scale()
{
for ( auto& H : channels )
- if ( sigfile::SChannel::signal_type_is_fftable( H.type) )
+ if ( H.schannel().is_fftable() )
H.update_profile_display_scales();
}
diff --git a/src/ui/sf/sf.hh b/src/ui/sf/sf.hh
index 80256d5..00cbcbf 100644
--- a/src/ui/sf/sf.hh
+++ b/src/ui/sf/sf.hh
@@ -81,6 +81,9 @@ class SScoringFacility
agh::CRecording&
crecording;
int _h;
+ const sigfile::SChannel&
+ schannel() const
+ { return crecording.F().channel_by_id(_h); }
sigfile::SFilterPack&
filters;
list<sigfile::SAnnotation>&
--
Sleep experiment manager
More information about the debian-med-commit
mailing list