当前位置: 首页>>代码示例>>C++>>正文


C++ GenericSignal::Channels方法代码示例

本文整理汇总了C++中GenericSignal::Channels方法的典型用法代码示例。如果您正苦于以下问题:C++ GenericSignal::Channels方法的具体用法?C++ GenericSignal::Channels怎么用?C++ GenericSignal::Channels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GenericSignal的用法示例。


在下文中一共展示了GenericSignal::Channels方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: lock

void
SignalDisplay::AdaptTo( const GenericSignal& inSignal )
{
    // Any changes in the signal size that we must react to?
    bool reconfigure = false;
    if( inSignal.Elements() > mNumSamples )
    {
        OSMutex::Lock lock( mDataLock );
        SetNumSamples( inSignal.Elements() );
        reconfigure = true;
    }
    if( inSignal.Channels() != mData.Channels() )
    {
        OSMutex::Lock lock( mDataLock );
        int newNumDisplayGroups = ( inSignal.Channels() - mMarkerChannels - 1 ) / mChannelGroupSize + 1;
        if( mNumDisplayGroups == 0 )
            mNumDisplayGroups = min<int>( newNumDisplayGroups, cInitialMaxDisplayGroups );
        else if( newNumDisplayGroups < mNumDisplayGroups )
            mNumDisplayGroups = newNumDisplayGroups;
        reconfigure = true;
    }
    if( reconfigure )
    {
        OSMutex::Lock lock( mDataLock );
        mData = GenericSignal( inSignal.Channels(), mNumSamples );
        SetDisplayGroups( DisplayGroups() );
        SyncLabelWidth();
        mSampleCursor = 0;
        Invalidate();
    }
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:31,代码来源:SignalDisplay.cpp

示例2: lock

// The Process() function is called from the main thread in regular intervals.
void
BufferedADC::Process( const GenericSignal&,
                      GenericSignal& Output )
{
    this->OnProcess();
    AcquisitionBuffer& buffer = mpBuffers[mReadCursor];
    ++mReadCursor %= mSourceBufferSize;

    Lock lock( buffer );
    if( !IsAcquiring() )
    {
        bcierr_ << ( mError.empty() ? "Acquisition Error" : mError );
        if( State( "Running" ) )
            State( "Running" ) = 0;
        return;
    }

    if( buffer.Signal.Channels() == Output.Channels() )
        Output = buffer.Signal;
    else
    {
        const LabelIndex& labels = mAcquisitionProperties.ChannelLabels();
        for( int el = 0; el < Output.Elements(); ++el )
        {
            for( int ch = 0; ch < Output.Channels(); ++ch )
                Output( ch, el ) = buffer.Signal( ch, el );
            for( int ch = Output.Channels(); ch < buffer.Signal.Channels(); ++ch )
                State( labels[ch].c_str() + 1 )( el ) = static_cast<State::ValueType>( buffer.Signal( ch, el ) );
        }
    }
    State( "SourceTime" ) = buffer.TimeStamp;
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:33,代码来源:BufferedADC.cpp

示例3:

void
DisplayFilter::Process( const GenericSignal& Input, GenericSignal& Output )
{
  if( Input.Channels() != mFilter.Channels() )
    mFilter.Initialize( Input.Channels() );
  mFilter.Process( Input, Output );
  if( mFilter.NanStalled() )
    mFilter.Initialize();
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:9,代码来源:DisplayFilter.cpp

示例4: Input

void
SpatialFilter::Process( const GenericSignal& Input, GenericSignal& Output )
{
  // Actually perform Spatial Filtering on the input and write it into the output signal.
  for( int sample = 0; sample < Input.Elements(); ++sample )
    for( int outChannel = 0; outChannel < Output.Channels(); ++outChannel )
    {
      double value = 0;
      for( int inChannel = 0; inChannel < Input.Channels(); ++inChannel )
        value += mFilterMatrix[ outChannel ][ inChannel ] * Input( inChannel, sample );
      Output( outChannel, sample ) = value;
    }
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:13,代码来源:SpatialFilter.cpp

示例5: Input

void
Normalizer::Process( const GenericSignal& Input, GenericSignal& Output )
{
  if( mDoAdapt )
  {
    for( size_t channel = 0; channel < mBufferConditions.size(); ++channel )
      for( size_t buffer = 0; buffer < mBufferConditions[ channel ].size(); ++buffer )
      {
        double label = mBufferConditions[ channel ][ buffer ].Evaluate( &Input );
        if( label != 0 )
          for( int sample = 0; sample < Input.Elements(); ++sample )
            mDataBuffers[ channel ][ buffer ].Put( Input( channel, sample ) );
      }
    if( mpUpdateTrigger != NULL )
    {
      bool currentTrigger = mpUpdateTrigger->Evaluate( &Input );
      if( currentTrigger && !mPreviousTrigger )
        Update();
      mPreviousTrigger = currentTrigger;
    }
    else
      Update();
  }

  for( int channel = 0; channel < Input.Channels(); ++channel )
    for( int sample = 0; sample < Input.Elements(); ++sample )
      Output( channel, sample )
        = ( Input( channel, sample ) - mOffsets[ channel ] ) * mGains[ channel ];
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:29,代码来源:Normalizer.cpp

示例6: inSignal

////////////////////////////////////////////////////////////////////////////////
// MatlabEngine::DoubleMatrix definitions                                     //
////////////////////////////////////////////////////////////////////////////////
MatlabEngine::DoubleMatrix::DoubleMatrix( const GenericSignal& inSignal )
    : vector<vector<double> >( inSignal.Channels(), vector<double>( inSignal.Elements() ) )
{
    for( size_t channel = 0; channel < size(); ++channel )
        for( size_t sample = 0; sample < ( *this )[ channel ].size(); ++sample )
            ( *this )[ channel ][ sample ] = inSignal( channel, sample );
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:10,代码来源:MatlabWrapper.cpp

示例7: switch

void
BCI2000OutputFormat::Write( ostream& os, const GenericSignal& inSignal, const StateVector& inStatevector )
{
  switch( mInputProperties.Type() )
  {
    case SignalType::int16:
    case SignalType::float32:
    case SignalType::int32:
      // Note that the order of Elements and Channels differs from the one in the
      // socket protocol.
      for( int j = 0; j < inSignal.Elements(); ++j )
      {
        for( int i = 0; i < inSignal.Channels(); ++i )
          inSignal.WriteValueBinary( os, i, j );
        os.write(
          reinterpret_cast<const char*>( inStatevector( min( j, inStatevector.Samples() - 1 ) ).Data() ),
          inStatevector.Length()
        );
      }
      break;

    default:
      bcierr << "Unsupported signal data type" << endl;
  }
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:25,代码来源:BCI2000OutputFormat.cpp

示例8: ControlSignal

void
CursorFeedbackTask::DoFeedback( const GenericSignal& ControlSignal, bool& doProgress )
{
  // Update cursor position
  float x = mpFeedbackScene->CursorXPosition(),
        y = mpFeedbackScene->CursorYPosition(),
        z = mpFeedbackScene->CursorZPosition();

  if( ControlSignal.Channels() > 0 )
    x += mCursorSpeedX * ControlSignal( 0, 0 );
  if( ControlSignal.Channels() > 1 )
    y += mCursorSpeedY * ControlSignal( 1, 0 );
  if( ControlSignal.Channels() > 2 )
    z += mCursorSpeedZ * ControlSignal( 2, 0 );

  // Restrict cursor movement to the inside of the bounding box:
  float r = mpFeedbackScene->CursorRadius();
  x = max( r, min( 100 - r, x ) ),
  y = max( r, min( 100 - r, y ) ),
  z = max( r, min( 100 - r, z ) );
  mpFeedbackScene->SetCursorPosition( x, y, z );

  const float coordToState = ( ( 1 << cCursorPosBits ) - 1 ) / 100.0;
  State( "CursorPosX" ) = static_cast<int>( x * coordToState );
  State( "CursorPosY" ) = static_cast<int>( y * coordToState );
  State( "CursorPosZ" ) = static_cast<int>( z * coordToState );

  // Test for target hits
  if( Parameter( "TestAllTargets" ) != 0 )
  {
    int hitTarget = 0;
    for( int i = 0; i < mpFeedbackScene->NumTargets(); ++i )
      if( mpFeedbackScene->TargetHit( i ) )
      { // In case of a positive hit test for multiple targets, take the closer one.
        if( hitTarget == 0 || mpFeedbackScene->CursorTargetDistance( hitTarget - 1 ) > mpFeedbackScene->CursorTargetDistance( i ) )
          hitTarget = i + 1;
      }
    State( "ResultCode" ) = hitTarget;
  }
  else
  {
    if( mpFeedbackScene->TargetHit( State( "TargetCode" ) - 1 ) )
      State( "ResultCode" ) = State( "TargetCode" );
  }
  doProgress = ( ++mCurFeedbackDuration > mMaxFeedbackDuration );
  doProgress = doProgress || ( State( "ResultCode" ) != 0 );
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:47,代码来源:CursorFeedbackTask.cpp

示例9: Input

void
TaskFilter::Process( const GenericSignal& Input, GenericSignal& Output )
{
  if( Input.Channels() > 0 )
  {
    float cursorX = mWindow.CursorX() + mCursorSpeed * Input( 0, 0 );
	mWindow.SetCursorX( cursorX - ::floor( cursorX ) );
  }
  if( Input.Channels() > 1 )
  {
    float cursorY = mWindow.CursorY() + mCursorSpeed * Input( 1, 0 );
	mWindow.SetCursorY( cursorY - ::floor( cursorY ) );
  }
  mWindow.RedrawWindow();
  State( "StimulusTime" ) = PrecisionTime::Now();
  Output = Input;
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:17,代码来源:TaskFilter.cpp

示例10: Output

void
LinearClassifier::Process( const GenericSignal& Input, GenericSignal& Output )
{
  for( int ch = 0; ch < Output.Channels(); ++ch )
    for( int el = 0; el < Output.Elements(); ++el )
      Output( ch, el ) = 0.0;

  for( size_t i = 0; i < mWeights.size(); ++i )
    Output( mOutputChannels[ i ], 0 )
      += Input( mInputChannels[ i ], mInputElements[ i ] ) * mWeights[ i ];
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:11,代码来源:LinearClassifier.cpp

示例11: inSignal

void
EDFFileWriterBase::PutBlock( const GenericSignal& inSignal, const StateVector& inStatevector )
{
  for( int i = 0; i < inSignal.Channels(); ++i )
    for( int j = 0; j < inSignal.Elements(); ++j )
      GDF::Num<T>( inSignal( i, j ) ).WriteToStream( OutputStream() );
  for( size_t i = 0; i < mStateNames.size(); ++i )
    GDF::PutField< GDF::Num<GDF::int16> >(
      OutputStream(),
      inStatevector.StateValue( mStateNames[ i ] )
    );
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:12,代码来源:EDFFileWriterBase.cpp

示例12: if

void
RDAClientADC::DoAcquire( GenericSignal& Output )
{
  if( !mConnection.ReceiveData( Output ) )
    Error( "Lost connection to VisionRecorder software" );
  else if( mAddMarkerChannel )
  {
    int from = Output.Channels() - 2,
        to = from + 1;
    for( int el = 0; el < Output.Elements(); ++el )
      Output( to, el ) = Output( from, el );
  }
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:13,代码来源:RDAClientADC.cpp

示例13: Process

// **************************************************************************
// Function:   Process
// Purpose:    This function is called within the data acquisition loop
//             it fills its output signal with values
//             and does not return until all data has been acquired.
// Parameters: References to input signal (ignored) and output signal.
// Returns:    N/A
// **************************************************************************
void NicoletOneADC::Process( const GenericSignal&, GenericSignal& Output )
{
  // Grab the data for each channel and sample, push it into the output
  bool newData = false;
  while( !newData )
  {
    // Grab new information from thread
    bool newTsInfo = false;
    newData = !( mNT->ExtractData( Output.Channels(), Output.Elements(), mDataBlock, newTsInfo ) );

	// If we have a new data block, we can fill out sample block
    if( newData )
      for( int sample = 0; sample < Output.Elements(); ++sample )
	    for( int channel = 0; channel < Output.Channels(); ++channel )		
		  Output( channel, sample ) = mDataBlock[channel][sample];

	// If we have new TsInfo we need to see if its still valid.
    if( newTsInfo )
    {
	  // We need to check the signal properties to verify that all is well.
	  // Check the number of channels
	  int numChannels = 0;
	  while( mNT->GetNumChannels( &numChannels ) )
		Sleep( 10 );
	  if( mChannels != numChannels )
		bcierr << "The number of channels reported has changed.  Experiment is ending. Device is reporting " << numChannels << " channels" << endl;

	  // Check Sampling Rate
	  double rate = 0.0f;
	  while( mNT->GetSampleRate( &rate ) )
		  Sleep( 10 );
	  if( mSamplingRate != (int)rate )
		bcierr << "Sampling Rate has changed.  Experiment is ending.  Device is reporting " << (int)rate << " Hz." << endl;
    }

    // Needed?
    Sleep( 10 );
  }
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:47,代码来源:NicoletOneADC.cpp

示例14: Idle

void
BrainVisionGDRConverter::OutputSignal( const GenericSignal& inSignal, long /*inSamplePos*/ )
{
  Idle();
  for( int sample = 0; sample < inSignal.Elements(); ++sample )
    for( int channel = 0; channel < inSignal.Channels(); ++channel )
    {
      float value = inSignal( channel, sample );
      mDataFile.write( reinterpret_cast<const char*>( &value ), sizeof( value ) );
    }

  if( !mDataFile )
    bcierr << "Error writing data file" << endl;
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:14,代码来源:BrainVisionConverter.cpp

示例15: Output

void
RDAClientADC::Process( const GenericSignal&, GenericSignal& Output )
{
  for( int sample = 0; sample < Output.Elements(); ++sample )
    for( int channel = 0; channel < Output.Channels(); ++channel )
    {
      if( !mInputQueue )
      {
        bcierr << "Lost connection to VisionRecorder software" << endl;
        return;
      }
      Output( channel, sample ) = mInputQueue.front();
      mInputQueue.pop();
    }
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:15,代码来源:RDAClientADC.cpp


注:本文中的GenericSignal::Channels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。