[med-svn] [aghermann] 16/60: continue 6959a6c38d and make a shortcut method SScoringFacility::SChannel::type()
andrei zavada
hmmr-guest at alioth.debian.org
Mon Nov 4 23:49:54 UTC 2013
This is an automated email from the git hooks/post-receive script.
hmmr-guest pushed a commit to branch WIP
in repository aghermann.
commit f406a73379cf3baa3be0c00f0605f585a3179e00
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Fri Oct 11 13:41:56 2013 +0300
continue 6959a6c38d and make a shortcut method SScoringFacility::SChannel::type()
---
upstream/src/aghermann/ui/mw/mainmenu_cb.cc | 4 +--
upstream/src/aghermann/ui/sf/channel.cc | 28 ++++++++++----------
upstream/src/aghermann/ui/sf/channel.hh | 5 +++-
upstream/src/aghermann/ui/sf/d/patterns.cc | 2 +-
.../src/aghermann/ui/sf/d/phasediff-construct.cc | 2 +-
upstream/src/aghermann/ui/sf/ica.cc | 2 +-
upstream/src/aghermann/ui/sf/montage-menus_cb.cc | 6 ++---
upstream/src/aghermann/ui/sf/montage-overlays.cc | 8 +++---
upstream/src/aghermann/ui/sf/montage.cc | 6 ++---
upstream/src/aghermann/ui/sf/montage_cb.cc | 14 +++++-----
upstream/src/aghermann/ui/sf/sf.cc | 12 ++++-----
upstream/src/common/lang.hh | 18 ++++++-------
12 files changed, 55 insertions(+), 52 deletions(-)
diff --git a/upstream/src/aghermann/ui/mw/mainmenu_cb.cc b/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
index c0c16df..814f51c 100644
--- a/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
+++ b/upstream/src/aghermann/ui/mw/mainmenu_cb.cc
@@ -360,7 +360,7 @@ iExpGloballyDetectArtifacts_activate_cb(
for ( auto& SF : ED.open_scoring_facilities ) {
for ( auto& H : SF->channels )
- if ( H.schannel().type() == sigfile::SChannel::TType::eeg )
+ if ( H.type() == sigfile::SChannel::TType::eeg )
H.get_signal_filtered();
SF->queue_redraw_all();
}
@@ -425,7 +425,7 @@ iExpGloballySetFilters_activate_cb(
for ( auto& SF : ED.open_scoring_facilities ) {
for ( auto& H : SF->channels )
- if ( H.schannel().type() == sigfile::SChannel::TType::eeg )
+ if ( H.type() == sigfile::SChannel::TType::eeg )
H.get_signal_filtered();
SF->queue_redraw_all();
}
diff --git a/upstream/src/aghermann/ui/sf/channel.cc b/upstream/src/aghermann/ui/sf/channel.cc
index 08e262a..5ed6a22 100644
--- a/upstream/src/aghermann/ui/sf/channel.cc
+++ b/upstream/src/aghermann/ui/sf/channel.cc
@@ -113,7 +113,7 @@ SChannel (agh::CRecording& r,
get_signal_filtered();
// psd power and spectrum, mc
- if ( schannel().is_fftable() ) {
+ 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;
@@ -147,7 +147,7 @@ SChannel (agh::CRecording& r,
// don't: interchannel_gap is rubbish yet
psd.focused_band = metrics::TBand::delta;
- } else if ( schannel().type() == sigfile::SChannel::TType::emg ) {
+ } else if ( type() == sigfile::SChannel::TType::emg ) {
get_raw_profile();
hist_range_min = 0.;
@@ -321,7 +321,7 @@ tuple<metrics::TType, valarray<TFloat>&>
SScoringFacility::SChannel::
which_profile( const metrics::TType metric)
{
- switch ( schannel().type() ) {
+ switch ( type() ) {
case sigfile::SChannel::TType::eeg:
switch ( metric ) {
case metrics::TType::mc:
@@ -411,7 +411,7 @@ detect_artifacts( const metrics::mc::SArtifactDetectionPPack& P)
calculate_dirty_percent();
get_signal_filtered();
- if ( schannel().type() == sigfile::SChannel::TType::eeg ) {
+ if ( type() == sigfile::SChannel::TType::eeg ) {
get_psd_course();
get_psd_in_bands();
get_spectrum( _p.cur_page());
@@ -453,7 +453,7 @@ mark_flat_regions_as_artifacts( const double minsize, const double pad)
calculate_dirty_percent();
get_signal_filtered();
- if ( schannel().type() == sigfile::SChannel::TType::eeg ) {
+ if ( type() == sigfile::SChannel::TType::eeg ) {
get_psd_course();
get_psd_in_bands();
get_spectrum( _p.cur_page());
@@ -475,15 +475,15 @@ mark_emg_perturbations_as_artifacts( const double min_steadytone_factor, const d
{
// which EMG channels are there?
forward_list<SChannel*> HH;
- for ( auto &H : channels )
- if ( H.schannel.type() == sigfile::SChannel::TType::emg )
+ for ( auto &H : _p.channels )
+ if ( H.type() == sigfile::SChannel::TType::emg )
HH.push_front( &H);
if ( HH.empty() )
- return -1;
+ return {0., 0.};
- return { (double)marked_here/samplerate(),
- (double)(artifacts.total() - total_before) };
+ // return { (double)marked_here/samplerate(),
+ // (double)(artifacts.total() - total_before) };
}
@@ -506,7 +506,7 @@ mark_region_as_artifact( const bool do_mark)
get_signal_filtered();
- if ( schannel.type() == sigfile::SChannel::TType::eeg ) {
+ if ( type() == sigfile::SChannel::TType::eeg ) {
get_psd_course();
get_psd_in_bands();
get_spectrum( _p.cur_page());
@@ -573,8 +573,8 @@ update_channel_menu_items( const double x)
gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawEnvelope, draw_selection_envelope);
gtk_check_menu_item_set_active( _p.iSFPageSelectionDrawDzxdf, draw_selection_dzcdf);
- bool is_eeg = (schannel().type() == sigfile::SChannel::TType::eeg),
- is_emg = (schannel().type() == sigfile::SChannel::TType::emg),
+ bool is_eeg = (type() == sigfile::SChannel::TType::eeg),
+ is_emg = (type() == sigfile::SChannel::TType::emg),
have_profile = is_eeg or is_emg;
gtk_widget_set_visible( (GtkWidget*)_p.iSFPageProfilesSubmenuSeparator, have_profile);
gtk_widget_set_visible( (GtkWidget*)_p.iiSFPageProfiles, have_profile);
@@ -612,7 +612,7 @@ update_power_menu_items()
gtk_check_menu_item_set_active( _p.iSFPowerAutoscale, (gboolean)autoscale_profile);
gtk_widget_set_visible( (GtkWidget*)_p.iSFPowerDrawBands,
- (schannel().type() == sigfile::SChannel::TType::eeg &&
+ (type() == sigfile::SChannel::TType::eeg &&
draw_psd));
_p.suppress_redraw = false;
}
diff --git a/upstream/src/aghermann/ui/sf/channel.hh b/upstream/src/aghermann/ui/sf/channel.hh
index 2f3521f..5c63b8f 100644
--- a/upstream/src/aghermann/ui/sf/channel.hh
+++ b/upstream/src/aghermann/ui/sf/channel.hh
@@ -51,7 +51,7 @@ struct SScoringFacility::SChannel {
// references to CExpDesign objects we represent
agh::CRecording&
crecording;
- sigfile::SChannel&
+ const sigfile::SChannel&
schannel;
// shortcuts
@@ -61,6 +61,9 @@ struct SScoringFacility::SChannel {
const char*
name() const
{ return schannel.name(); }
+ sigfile::SChannel::TType
+ type() const
+ { return schannel.type(); }
// contents
sigfile::SFilterPack&
diff --git a/upstream/src/aghermann/ui/sf/d/patterns.cc b/upstream/src/aghermann/ui/sf/d/patterns.cc
index 12f350b..d69b488 100644
--- a/upstream/src/aghermann/ui/sf/d/patterns.cc
+++ b/upstream/src/aghermann/ui/sf/d/patterns.cc
@@ -389,7 +389,7 @@ update_field_check_menu_items()
suppress_redraw = true;
gtk_check_menu_item_set_active( iSFFDFieldDrawMatchIndex, draw_match_index);
- if ( not field_channel->schannel().is_fftable() ) {
+ if ( not field_channel->schannel.is_fftable() ) {
field_profile_type = metrics::TType::raw;
gtk_widget_set_visible( (GtkWidget*)iiSFFDFieldProfileTypes, FALSE);
} else
diff --git a/upstream/src/aghermann/ui/sf/d/phasediff-construct.cc b/upstream/src/aghermann/ui/sf/d/phasediff-construct.cc
index 3e211b0..e6c4bf7 100644
--- a/upstream/src/aghermann/ui/sf/d/phasediff-construct.cc
+++ b/upstream/src/aghermann/ui/sf/d/phasediff-construct.cc
@@ -38,7 +38,7 @@ SPhasediffDialogWidgets (SScoringFacility& SF)
// filter channels we don't have
for ( auto &H : SF.channels )
- if ( H.schannel().type() == sigfile::SChannel::TType::eeg ) {
+ if ( H.type() == sigfile::SChannel::TType::eeg ) {
GtkTreeIter iter;
gtk_list_store_append(
mSFPDChannels,
diff --git a/upstream/src/aghermann/ui/sf/ica.cc b/upstream/src/aghermann/ui/sf/ica.cc
index adc5526..a88f22e 100644
--- a/upstream/src/aghermann/ui/sf/ica.cc
+++ b/upstream/src/aghermann/ui/sf/ica.cc
@@ -284,7 +284,7 @@ apply_remix( const bool do_backup)
H.signal_reconstituted = valarray<TFloat> (0);
H.get_signal_original();
H.get_signal_filtered();
- if ( H.schannel().type() == sigfile::SChannel::TType::eeg ) {
+ if ( H.type() == sigfile::SChannel::TType::eeg ) {
H.get_psd_course();
H.get_psd_in_bands();
H.get_mc_course();
diff --git a/upstream/src/aghermann/ui/sf/montage-menus_cb.cc b/upstream/src/aghermann/ui/sf/montage-menus_cb.cc
index 14c0c6b..f76f2b5 100644
--- a/upstream/src/aghermann/ui/sf/montage-menus_cb.cc
+++ b/upstream/src/aghermann/ui/sf/montage-menus_cb.cc
@@ -295,7 +295,7 @@ iSFPageFilter_activate_cb(
H.filters = FD.P;
H.get_signal_filtered();
- if ( H.schannel().type() == sigfile::SChannel::TType::eeg ) {
+ if ( H.type() == sigfile::SChannel::TType::eeg ) {
H.get_psd_course();
H.get_psd_in_bands();
H.get_spectrum( SF.cur_page());
@@ -376,7 +376,7 @@ iSFPageArtifactsClear_activate_cb(
SF.using_channel->artifacts().clear();
SF.using_channel->get_signal_filtered();
- if ( SF.using_channel->schannel().type() == sigfile::SChannel::TType::eeg ) {
+ if ( SF.using_channel->type() == sigfile::SChannel::TType::eeg ) {
SF.using_channel->get_psd_course();
SF.using_channel->get_psd_in_bands();
SF.using_channel->get_spectrum();
@@ -846,7 +846,7 @@ iSFPowerSmooth_toggled_cb(
auto& SF = *(SScoringFacility*)userdata;
if ( SF.suppress_redraw )
return;
- if ( likely (SF.using_channel->schannel().type() == sigfile::SChannel::TType::eeg ) ) {
+ if ( likely (SF.using_channel->type() == sigfile::SChannel::TType::eeg ) ) {
SF.using_channel->resample_power = (bool)gtk_check_menu_item_get_active( menuitem);
SF.using_channel->get_psd_course();
SF.using_channel->get_psd_in_bands();
diff --git a/upstream/src/aghermann/ui/sf/montage-overlays.cc b/upstream/src/aghermann/ui/sf/montage-overlays.cc
index 26056cf..22c05aa 100644
--- a/upstream/src/aghermann/ui/sf/montage-overlays.cc
+++ b/upstream/src/aghermann/ui/sf/montage-overlays.cc
@@ -34,7 +34,7 @@ draw_overlays( cairo_t* cr,
bool overlay = false;
// PSD profile
- if ( draw_psd and schannel().type() == sigfile::SChannel::TType::eeg ) {
+ if ( draw_psd and type() == sigfile::SChannel::TType::eeg ) {
overlay = true;
cairo_set_line_width( cr, 1.);
@@ -181,7 +181,7 @@ draw_overlays( cairo_t* cr,
}
}
- if ( draw_mc and schannel().type() == sigfile::SChannel::TType::eeg ) {
+ if ( draw_mc and type() == sigfile::SChannel::TType::eeg ) {
overlay = true;
cairo_set_line_width( cr, 1.);
@@ -226,7 +226,7 @@ draw_overlays( cairo_t* cr,
}
- if ( draw_swu and schannel().type() == sigfile::SChannel::TType::eeg ) {
+ if ( draw_swu and type() == sigfile::SChannel::TType::eeg ) {
overlay = true;
cairo_set_line_width( cr, 1.);
@@ -299,7 +299,7 @@ draw_overlays( cairo_t* cr,
// EMG profile
if ( draw_emg and
- schannel().type() == sigfile::SChannel::TType::emg ) {
+ type() == sigfile::SChannel::TType::emg ) {
overlay = true;
cairo_pattern_t *cp = cairo_pattern_create_linear( 0., pbot-EMGProfileHeight, 0., pbot);
diff --git a/upstream/src/aghermann/ui/sf/montage.cc b/upstream/src/aghermann/ui/sf/montage.cc
index 44daf77..2715336 100644
--- a/upstream/src/aghermann/ui/sf/montage.cc
+++ b/upstream/src/aghermann/ui/sf/montage.cc
@@ -366,7 +366,7 @@ draw_page( cairo_t *cr,
cairo_show_text( cr, global::buf);
// MC metrics
- if ( schannel().type() == sigfile::SChannel::TType::eeg &&
+ if ( type() == sigfile::SChannel::TType::eeg &&
selection_end_time - selection_start_time > 2. ) {
cairo_set_font_size( cr, 10);
@@ -578,7 +578,7 @@ draw_page( cairo_t *cr,
{
int x = 15, y = y0 - 16;
- snprintf_buf( "[%s] %s", schannel().type_s(), schannel().name());
+ snprintf_buf( "[%s] %s", schannel.type_s(), name());
cairo_select_font_face( cr, "serif", CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size( cr, 14);
@@ -617,7 +617,7 @@ draw_page( cairo_t *cr,
}
// EMG baseline tone
- if ( draw_emg_steady_tone && schannel().type() == sigfile::SChannel::TType::emg ) {
+ if ( draw_emg_steady_tone && type() == sigfile::SChannel::TType::emg ) {
cairo_set_line_width( cr, 1.);
_p._p.CwB[SExpDesignUI::TColour::sf_ticks].set_source_rgba( cr);
cairo_move_to( cr, 0, y0 - emg_steady_tone/2 * signal_display_scale);
diff --git a/upstream/src/aghermann/ui/sf/montage_cb.cc b/upstream/src/aghermann/ui/sf/montage_cb.cc
index 17a86e5..6a2a6d7 100644
--- a/upstream/src/aghermann/ui/sf/montage_cb.cc
+++ b/upstream/src/aghermann/ui/sf/montage_cb.cc
@@ -127,7 +127,7 @@ daSFMontage_button_press_event_cb(
auto Ch = SF.using_channel = SF.channel_near( event->y);
- if ( Ch->schannel().type() == sigfile::SChannel::TType::eeg &&
+ if ( Ch->type() == sigfile::SChannel::TType::eeg &&
(Ch->draw_psd || Ch->draw_mc) && event->y > Ch->zeroy ) {
switch ( event->button ) {
case 1:
@@ -147,7 +147,7 @@ daSFMontage_button_press_event_cb(
break;
}
- } else if ( Ch->schannel().type() == sigfile::SChannel::TType::emg &&
+ } else if ( Ch->type() == sigfile::SChannel::TType::emg &&
Ch->draw_emg && event->y > Ch->zeroy ) {
switch ( event->button ) {
case 1:
@@ -367,7 +367,7 @@ daSFMontage_button_release_event_cb(
}
gtk_widget_queue_draw( wid);
- } else if ( Ch->schannel().type() == sigfile::SChannel::TType::eeg &&
+ } else if ( Ch->type() == sigfile::SChannel::TType::eeg &&
(Ch->draw_psd || Ch->draw_mc) && event->y > Ch->zeroy )
SF.set_cur_vpage( (event->x / SF.da_wd) * SF.total_vpages());
@@ -490,13 +490,13 @@ daSFMontage_scroll_event_cb(
}
if ( event->state & GDK_CONTROL_MASK )
for ( auto& H : SF.channels ) {
- if ( Ch->schannel().type() == sigfile::SChannel::TType::eeg &&
- H.schannel().type() == sigfile::SChannel::TType::eeg ) {
+ if ( Ch->type() == sigfile::SChannel::TType::eeg &&
+ H.type() == sigfile::SChannel::TType::eeg ) {
H.psd.display_scale = Ch->psd.display_scale;
H.mc.display_scale = Ch->mc.display_scale;
H.swu.display_scale = Ch->swu.display_scale;
- } else if ( Ch->schannel().type() == sigfile::SChannel::TType::emg &&
- H.schannel().type() == sigfile::SChannel::TType::emg )
+ } else if ( Ch->type() == sigfile::SChannel::TType::emg &&
+ H.type() == sigfile::SChannel::TType::emg )
H.signal_display_scale = Ch->signal_display_scale;
}
gtk_widget_queue_draw( wid);
diff --git a/upstream/src/aghermann/ui/sf/sf.cc b/upstream/src/aghermann/ui/sf/sf.cc
index f2ce60d..5f60f5c 100644
--- a/upstream/src/aghermann/ui/sf/sf.cc
+++ b/upstream/src/aghermann/ui/sf/sf.cc
@@ -160,7 +160,7 @@ SScoringFacility (agh::CSubject& J,
n_eeg_channels =
count_if( channels.begin(), channels.end(),
[] (const SChannel& h)
- { return h.schannel().type() == sigfile::SChannel::TType::eeg; });
+ { return h.type() == sigfile::SChannel::TType::eeg; });
// load montage, recalibrate display scales as necessary
load_montage();
@@ -176,7 +176,7 @@ SScoringFacility (agh::CSubject& J,
interchannel_gap / 2);
agh::alg::ensure_within( h.signal_display_scale, 1e-6, 1e6);
- if ( h.schannel().type() == sigfile::SChannel::TType::eeg ) {
+ if ( h.type() == sigfile::SChannel::TType::eeg ) {
// calibrate profile display scales
if ( not isfinite(h.psd.display_scale) )
h.psd.display_scale =
@@ -448,7 +448,7 @@ SScoringFacility::
update_all_channels_profile_display_scale()
{
for ( auto& H : channels )
- if ( H.schannel().is_fftable() )
+ if ( H.schannel.is_fftable() )
H.update_profile_display_scales();
}
@@ -524,7 +524,7 @@ set_cur_vpage( size_t p, const bool touch_self)
if ( ap2p(p) != _cur_page ) { // vpage changed but page is same
_cur_page = ap2p(p);
for ( auto& H : channels )
- if ( H.schannel().type() == sigfile::SChannel::TType::eeg && H.draw_spectrum )
+ if ( H.type() == sigfile::SChannel::TType::eeg && H.draw_spectrum )
H.get_spectrum( _cur_page);
gtk_widget_set_sensitive( (GtkWidget*)bSFForward, _cur_vpage < total_vpages()-1);
@@ -750,9 +750,9 @@ load_montage()
h.selection_end = h.selection_end_time * h.samplerate();
// make sure these won't cause any confusion later
- if ( h.schannel().type() == sigfile::SChannel::TType::eeg )
+ if ( h.type() == sigfile::SChannel::TType::eeg )
h.draw_emg = false;
- if ( h.schannel().type() == sigfile::SChannel::TType::emg )
+ if ( h.type() == sigfile::SChannel::TType::emg )
h.draw_psd = h.draw_swu = h.draw_mc = false;
}
diff --git a/upstream/src/common/lang.hh b/upstream/src/common/lang.hh
index 89406ec..66f6edb 100644
--- a/upstream/src/common/lang.hh
+++ b/upstream/src/common/lang.hh
@@ -54,15 +54,15 @@ inline int dbl_cmp( double x, double y)
// gcc bits
-// # define __pure __attribute__ ((pure))
-// # define __const __attribute__ ((const))
-// # define __noreturn __attribute__ ((noreturn))
-// # define __malloc __attribute__ ((malloc))
-// # define __must_check __attribute__ ((warn_unused_result))
-// # define __deprecated __attribute__ ((deprecated))
-// # define __used __attribute__ ((used))
-// # define __unused __attribute__ ((unused))
-// # define __packed __attribute__ ((packed))
+// # define __pure __attribute__ ((pure))
+// # define __const __attribute__ ((const))
+// # define __noreturn __attribute__ ((noreturn))
+// # define __malloc __attribute__ ((malloc))
+// # define __must_check __attribute__ ((warn_unused_result))
+// # define __deprecated __attribute__ ((deprecated))
+// # define __used __attribute__ ((used))
+// # define __unused __attribute__ ((unused))
+// # define __packed __attribute__ ((packed))
#define likely(x) __builtin_expect (!!(x), 1)
#define unlikely(x) __builtin_expect (!!(x), 0)
--
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git
More information about the debian-med-commit
mailing list