Putting MatlabFilter at the beginning of a chain?

Forum for software developers to discuss BCI2000 software development
Locked
boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Putting MatlabFilter at the beginning of a chain?

Post by boulay » 21 Aug 2013, 06:24

I tried to make a new filter with the following PipeDefinition (located in BCI2000\src\custom\MatlabSpecSigProc):

Code: Select all

#include "PCHIncludes.h"
#pragma hdrstop

#include "MatlabFilter.h"
#include "SpatialFilter.h"
#include "SpectralEstimator.h"
#include "LinearClassifier.h"
#include "LPFilter.h"
#include "ExpressionFilter.h"
#include "Normalizer.h"

Filter( MatlabFilter, 2.B1 );
Filter( SpatialFilter, 2.B2 );
Filter( SpectralEstimator, 2.C );
Filter( LinearClassifier, 2.D );
Filter( LPFilter, 2.D1 );
Filter( ExpressionFilter, 2.D2 );
Filter( Normalizer, 2.E );
And the following CMakeLists.txt:

Code: Select all

SET( EXECUTABLE_NAME MatlabSpecSigProc )

# Set the project specific sources
SET( SRC_PROJECT
  PipeDefinition.cpp 
  ${BCI2000_SRC_DIR}/core/SignalProcessing/Matlab/MatlabFilter.cpp
  ${BCI2000_SRC_DIR}/core/SignalProcessing/Matlab/MatlabWrapper.cpp
)
SET( HDR_PROJECT
  ${BCI2000_SRC_DIR}/core/SignalProcessing/Matlab/MatlabFilter.h
  ${BCI2000_SRC_DIR}/core/SignalProcessing/Matlab/MatlabWrapper.h
)

# Make sure the macro knows we want to use EXTLIB libs!
BCI2000_USE( "MATLAB" )
BCI2000_USE( "FFT" )

# Create the signal processing module
BCI2000_ADD_SIGNAL_PROCESSING_MODULE( 
  "${EXECUTABLE_NAME}" 
  "${SRC_PROJECT}" "${HDR_PROJECT}" 
)
It builds successfully. When I try to SetConfig with it, I end up with this error, no matter what sampling rate I choose.

Code: Select all

2013-08-21T18:18:51 [SignalProcessing] SpectralEstimator::Preflight: SpectralEstimatorChoice::Preflight: ARSpectrum::Preflight: Zero input sampling rate.
It seems SpectralEstimator isn't getting the sampling rate. If I rebuild the module without the MatlabFilter then there is no problem. MatlabFilter's Preflight method seems to pass along the SignalProperties so I don't see how that's the problem.

Any ideas?

mellinger
Posts: 1341
Joined: 12 Feb 2003, 11:06

Re: Putting MatlabFilter at the beginning of a chain?

Post by mellinger » 09 Sep 2013, 12:29

Hi,

thanks for pointing out this problem.
In the most recent version on SVN, the MatlabFilter should now handle signal properties properly, such that subsequent filters are able to obtain necessary signal information.

In addition, the MatlabFilter now uses shared memory to transfer signals and states to and from Matlab, which should result in a considerably improved performance.

Regards,
Juergen

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Putting MatlabFilter at the beginning of a chain?

Post by boulay » 10 Sep 2013, 22:02

Hi Juergen,

I just did an SVN update and attempted to build MatlabSignalProcessing for Release x64 using VC2008 Express Edition. I received the following errors:

Code: Select all

3>------ Build started: Project: BCI2000FrameworkCore, Configuration: Release x64 ------
<<snip>>
2>..\..\..\..\src\shared\utils\OSSharedMemory.cpp(206) : error C2664: 'std::basic_fstream<_Elem,_Traits>::basic_fstream(const char *,std::ios_base::openmode,int)' : cannot convert parameter 1 from 'std::string' to 'const char *'
2>        with
2>        [
2>            _Elem=char,
2>            _Traits=std::char_traits<char>
2>        ]
2>        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Then, unsurprisingly, MatlabSignalProcessing fails to link to BCI2000FrameworkCore.lib

Code: Select all

5>LINK : fatal error LNK1181: cannot open input file '..\..\..\frameworks\CoreLib\Release\BCI2000FrameworkCore.lib'
5>Build log was saved at "file://d:\Tools\BCI2000\build\CMakeFiles\core\SignalProcessing\Matlab\MatlabSignalProcessing.dir\Release\BuildLog.htm"
5>MatlabSignalProcessing - 1 error(s), 0 warning(s)

mellinger
Posts: 1341
Joined: 12 Feb 2003, 11:06

Re: Putting MatlabFilter at the beginning of a chain?

Post by mellinger » 12 Sep 2013, 11:51

Sorry, that's been fixed by now.

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Putting MatlabFilter at the beginning of a chain?

Post by boulay » 13 Sep 2013, 05:18

Hi Juergen,

Thank you. I can confirm that it is working. I put the 64-bit executable in that other thread.

-Chad

Locked

Who is online

Users browsing this forum: No registered users and 0 guests