Commit e3b77327 authored by Jussi Lindgren's avatar Jussi Lindgren

plugins/processing/signal-processing:

 + Integrated Hilbert Transform algorithm and the corresponding box from wip-acellard-connectivity
git:
 * Added vim swap files .*.swp to .gitignore
parent 3f0a9afe
......@@ -4,4 +4,5 @@ scripts/win32-dependencies.cmd
dist
build
CMakeLists.txt.*
.*.swp
/**
* \page BoxAlgorithm_HilbertTransform Hilbert Transform
__________________________________________________________________
Detailed description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_HilbertTransform_Description|
This box computes the envelope and the instantaneous phase by performing the Discrete-Time Analytic signal [1] using Hilbert transform (see http://en.wikipedia.org/wiki/Analytic_signal).
The definition of analytic signal :
\image html AnalyticRepresentation.png
<!-- "Formula of the Analytic signal is x_a(t)=x(t)+i*H(x)(t)"-->
With \e x(t) the input signal, \e H(x) its Hilbert transform and \e i the imaginary unit.
For more informations on Hilbert transform and EEG see also : http://www.scholarpedia.org/article/Hilbert_transform_for_brain_waves
[1] Marple, S.L., "Computing the discrete-time analytic signal via FFT," IEEE Transactions on Signal Processing, Vol. 47, No.9 (September 1999), pp.2600-2603.
* |OVP_DocEnd_BoxAlgorithm_HilbertTransform_Description|
__________________________________________________________________
Inputs description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_HilbertTransform_Inputs|
* |OVP_DocEnd_BoxAlgorithm_HilbertTransform_Inputs|
* |OVP_DocBegin_BoxAlgorithm_HilbertTransform_Input1|
The input signal
* |OVP_DocEnd_BoxAlgorithm_HilbertTransform_Input1|
__________________________________________________________________
Outputs description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_HilbertTransform_Outputs|
* |OVP_DocEnd_BoxAlgorithm_HilbertTransform_Outputs|
* |OVP_DocBegin_BoxAlgorithm_HilbertTransform_Output1|
Return the Hilbert transform (imaginary part of the analytic signal) of the input
* |OVP_DocEnd_BoxAlgorithm_HilbertTransform_Output1|
* |OVP_DocBegin_BoxAlgorithm_HilbertTransform_Output2|
Return the envelope signal of the input
* |OVP_DocEnd_BoxAlgorithm_HilbertTransform_Output2|
* |OVP_DocBegin_BoxAlgorithm_HilbertTransform_Output3|
Return instantaneous phase of the input
* |OVP_DocEnd_BoxAlgorithm_HilbertTransform_Output3|
__________________________________________________________________
Examples description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_HilbertTransform_Examples|
<!--TO DO : Add some examples and screenshots of the results-->
* |OVP_DocEnd_BoxAlgorithm_HilbertTransform_Examples|
__________________________________________________________________
Miscellaneous description
__________________________________________________________________
* |OVP_DocBegin_BoxAlgorithm_HilbertTransform_Miscellaneous|
* |OVP_DocEnd_BoxAlgorithm_HilbertTransform_Miscellaneous|
*/
#if defined(TARGET_HAS_ThirdPartyEIGEN)
#include "ovpCHilbertTransform.h"
#include <complex>
#include <Eigen/Dense>
#include <unsupported/Eigen/FFT>
#include <iostream>
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
using namespace OpenViBE::Plugins;
using namespace OpenViBEPlugins;
using namespace OpenViBEPlugins::SignalProcessing;
using namespace Eigen;
boolean CAlgorithmHilbertTransform::initialize(void)
{
ip_pMatrix.initialize(this->getInputParameter(OVP_Algorithm_HilbertTransform_InputParameterId_Matrix));
op_pHilbertMatrix.initialize(this->getOutputParameter(OVP_Algorithm_HilbertTransform_OutputParameterId_HilbertMatrix));
op_pEnvelopeMatrix.initialize(this->getOutputParameter(OVP_Algorithm_HilbertTransform_OutputParameterId_EnvelopeMatrix));
op_pPhaseMatrix.initialize(this->getOutputParameter(OVP_Algorithm_HilbertTransform_OutputParameterId_PhaseMatrix));
return true;
}
boolean CAlgorithmHilbertTransform::uninitialize(void)
{
op_pHilbertMatrix.uninitialize();
op_pEnvelopeMatrix.uninitialize();
op_pPhaseMatrix.uninitialize();
ip_pMatrix.uninitialize();
return true;
}
boolean CAlgorithmHilbertTransform::process(void)
{
uint32 l_ui32ChannelCount = ip_pMatrix->getDimensionSize(0);
uint32 l_ui32SamplesPerChannel = ip_pMatrix->getDimensionSize(1);
IMatrix* l_pInputMatrix = ip_pMatrix;
IMatrix* l_pOutputHilbertMatrix = op_pHilbertMatrix;
IMatrix* l_pOutputEnvelopeMatrix = op_pEnvelopeMatrix;
IMatrix* l_pOutputPhaseMatrix = op_pPhaseMatrix;
if(this->isInputTriggerActive(OVP_Algorithm_HilbertTransform_InputTriggerId_Initialize)) //Check if the input is correct
{
if( l_pInputMatrix->getDimensionCount() != 2)
{
this->getLogManager() << LogLevel_Error << "The input matrix must have 2 dimensions, here the dimension is "<<l_pInputMatrix->getDimensionCount()<<"\n";
return false;
}
//Setting size of outputs
l_pOutputHilbertMatrix->setDimensionCount(2);
l_pOutputHilbertMatrix->setDimensionSize(0,l_ui32ChannelCount);
l_pOutputHilbertMatrix->setDimensionSize(1,l_ui32SamplesPerChannel);
l_pOutputEnvelopeMatrix->setDimensionCount(2);
l_pOutputEnvelopeMatrix->setDimensionSize(0,l_ui32ChannelCount);
l_pOutputEnvelopeMatrix->setDimensionSize(1,l_ui32SamplesPerChannel);
l_pOutputPhaseMatrix->setDimensionCount(2);
l_pOutputPhaseMatrix->setDimensionSize(0,l_ui32ChannelCount);
l_pOutputPhaseMatrix->setDimensionSize(1,l_ui32SamplesPerChannel);
for(uint32 i=0; i<l_ui32ChannelCount;i++)
{
l_pOutputHilbertMatrix->setDimensionLabel(0,i,l_pInputMatrix->getDimensionLabel(0,i));
l_pOutputEnvelopeMatrix->setDimensionLabel(0,i,l_pInputMatrix->getDimensionLabel(0,i));
l_pOutputPhaseMatrix->setDimensionLabel(0,i,l_pInputMatrix->getDimensionLabel(0,i));
}
}
if(this->isInputTriggerActive(OVP_Algorithm_HilbertTransform_InputTriggerId_Process))
{
//Computing Hilbert transform for all channels
for(uint32 channel=0; channel<l_ui32ChannelCount; channel++)
{
//Initialization of buffer vectors
m_vecXcdSignalBuffer = VectorXcd::Zero(l_ui32SamplesPerChannel);
m_vecXcdSignalFourier = VectorXcd::Zero(l_ui32SamplesPerChannel);
//Initialization of vector h used to compute analytic signal
m_vecXdHilbert.resize(l_ui32SamplesPerChannel);
m_vecXdHilbert(0) = 1.0;
if(l_ui32SamplesPerChannel%2 == 0)
{
m_vecXdHilbert(l_ui32SamplesPerChannel/2) = 1.0;
m_vecXdHilbert.segment(1,(l_ui32SamplesPerChannel/2)-1).setOnes();
m_vecXdHilbert.segment(1,(l_ui32SamplesPerChannel/2)-1) *= 2.0;
m_vecXdHilbert.tail((l_ui32SamplesPerChannel/2)+1).setZero();
}
else
{
m_vecXdHilbert((l_ui32SamplesPerChannel+1)/2) = 1.0;
m_vecXdHilbert.segment(1,(l_ui32SamplesPerChannel/2)).setOnes();
m_vecXdHilbert.segment(1,(l_ui32SamplesPerChannel/2)) *= 2.0;
m_vecXdHilbert.tail(((l_ui32SamplesPerChannel+1)/2)+1).setZero();
}
//Copy input signal chunk on buffer
for(uint32 samples=0; samples<l_ui32SamplesPerChannel;samples++)
{
m_vecXcdSignalBuffer(samples).real(l_pInputMatrix->getBuffer()[samples + channel * (l_ui32SamplesPerChannel)]);
m_vecXcdSignalBuffer(samples).imag(0.0);
}
//Fast Fourier Transform of input signal
m_fft.fwd(m_vecXcdSignalFourier, m_vecXcdSignalBuffer);
//Apply Hilbert transform by element-wise multiplying fft vector by h
m_vecXcdSignalFourier = m_vecXcdSignalFourier.cwiseProduct(m_vecXdHilbert);
//Inverse Fast Fourier transform
m_fft.inv(m_vecXcdSignalBuffer, m_vecXcdSignalFourier); // m_vecXcdSignalBuffer is now the analytical signal of the initial input signal
//Compute envelope and phase and pass it to the corresponding output
for(uint32 samples=0; samples<l_ui32SamplesPerChannel;samples++)
{
l_pOutputHilbertMatrix->getBuffer()[samples + channel*l_ui32SamplesPerChannel] = m_vecXcdSignalBuffer(samples).imag();
l_pOutputEnvelopeMatrix->getBuffer()[samples + channel*l_ui32SamplesPerChannel] = abs(m_vecXcdSignalBuffer(samples));
l_pOutputPhaseMatrix->getBuffer()[samples + channel*l_ui32SamplesPerChannel] = arg(m_vecXcdSignalBuffer(samples));
}
}
}
return true;
}
#endif //TARGET_HAS_ThirdPartyEIGEN
#if defined(TARGET_HAS_ThirdPartyEIGEN)
#ifndef __OpenViBEPlugins_Algorithm_HilbertTransform_H__
#define __OpenViBEPlugins_Algorithm_HilbertTransform_H__
#include "../../ovp_defines.h"
#include <openvibe/ov_all.h>
#include <toolkit/ovtk_all.h>
#include <Eigen/Dense>
#include <unsupported/Eigen/FFT>
#include <complex>
namespace OpenViBEPlugins
{
namespace SignalProcessing
{
class CAlgorithmHilbertTransform : public OpenViBEToolkit::TAlgorithm <OpenViBE::Plugins::IAlgorithm>
{
public:
virtual void release(void) { delete this; }
virtual OpenViBE::boolean initialize(void);
virtual OpenViBE::boolean uninitialize(void);
virtual OpenViBE::boolean process(void);
_IsDerivedFromClass_Final_(OpenViBEToolkit::TAlgorithm<OpenViBE::Plugins::IAlgorithm>, OVP_ClassId_Algorithm_HilbertTransform)
protected:
OpenViBE::Kernel::TParameterHandler <OpenViBE::IMatrix*> ip_pMatrix; //input matrix
OpenViBE::Kernel::TParameterHandler <OpenViBE::IMatrix*> op_pHilbertMatrix; //output matrix 1 : Hilbert transform of the signal
OpenViBE::Kernel::TParameterHandler <OpenViBE::IMatrix*> op_pEnvelopeMatrix; //output matrix 2 : Envelope of the signal
OpenViBE::Kernel::TParameterHandler <OpenViBE::IMatrix*> op_pPhaseMatrix; //output matrix 3 : Phase of the signal
private:
Eigen::VectorXcd m_vecXcdSignalBuffer; // Input signal Buffer
Eigen::VectorXcd m_vecXcdSignalFourier; // Fourier Transform of input signal
Eigen::VectorXd m_vecXdHilbert; // Vector h used to apply Hilbert transform
Eigen::FFT< double, Eigen::internal::kissfft_impl<double > > m_fft; //create instance of fft transform
};
class CAlgorithmHilbertTransformDesc : public OpenViBE::Plugins::IAlgorithmDesc
{
public:
virtual void release(void) { }
virtual OpenViBE::CString getName(void) const { return OpenViBE::CString("Hilbert Transform"); }
virtual OpenViBE::CString getAuthorName(void) const { return OpenViBE::CString("Alison Cellard"); }
virtual OpenViBE::CString getAuthorCompanyName(void) const { return OpenViBE::CString("INRIA"); }
virtual OpenViBE::CString getShortDescription(void) const { return OpenViBE::CString("Computes the Hilbert transform of a signal"); }
virtual OpenViBE::CString getDetailedDescription(void) const { return OpenViBE::CString("Give the analytic signal ua(t) = u(t) + iH(u(t)) of the input signal u(t) using Hilbert transform"); }
virtual OpenViBE::CString getCategory(void) const { return OpenViBE::CString("Signal processing/Basic"); }
virtual OpenViBE::CString getVersion(void) const { return OpenViBE::CString("0.1"); }
virtual OpenViBE::CString getStockItemName(void) const { return OpenViBE::CString("gtk-execute"); }
virtual OpenViBE::CIdentifier getCreatedClass(void) const { return OVP_ClassId_Algorithm_HilbertTransform; }
virtual OpenViBE::Plugins::IPluginObject* create(void) { return new OpenViBEPlugins::SignalProcessing::CAlgorithmHilbertTransform; }
virtual OpenViBE::boolean getAlgorithmPrototype(
OpenViBE::Kernel::IAlgorithmProto& rAlgorithmPrototype) const
{
rAlgorithmPrototype.addInputParameter (OVP_Algorithm_HilbertTransform_InputParameterId_Matrix, "Matrix", OpenViBE::Kernel::ParameterType_Matrix);
rAlgorithmPrototype.addOutputParameter(OVP_Algorithm_HilbertTransform_OutputParameterId_HilbertMatrix, "Hilbert Matrix", OpenViBE::Kernel::ParameterType_Matrix);
rAlgorithmPrototype.addOutputParameter(OVP_Algorithm_HilbertTransform_OutputParameterId_EnvelopeMatrix, "Envelope Matrix", OpenViBE::Kernel::ParameterType_Matrix);
rAlgorithmPrototype.addOutputParameter(OVP_Algorithm_HilbertTransform_OutputParameterId_PhaseMatrix, "Phase Matrix", OpenViBE::Kernel::ParameterType_Matrix);
rAlgorithmPrototype.addInputTrigger (OVP_Algorithm_HilbertTransform_InputTriggerId_Initialize, "Initialize");
rAlgorithmPrototype.addInputTrigger (OVP_Algorithm_HilbertTransform_InputTriggerId_Process, "Process");
rAlgorithmPrototype.addOutputTrigger (OVP_Algorithm_HilbertTransform_OutputTriggerId_ProcessDone, "Process done");
return true;
}
_IsDerivedFromClass_Final_(OpenViBE::Plugins::IAlgorithmDesc, OVP_ClassId_Algorithm_HilbertTransformDesc);
};
}; // namespace SignalProcessing
}; // namespace OpenViBEPlugins
#endif //__OpenViBEPlugins_Algorithm_HilbertTransform_H__
#endif //TARGET_HAS_ThirdPartyEIGEN
#include "ovpCBoxAlgorithmHilbert.h"
using namespace OpenViBE;
using namespace OpenViBE::Kernel;
using namespace OpenViBE::Plugins;
using namespace OpenViBEPlugins;
using namespace OpenViBEPlugins::SignalProcessingBasic;
boolean CBoxAlgorithmHilbert::initialize(void)
{
// Signal stream decoder
m_oAlgo0_SignalDecoder.initialize(*this);
// Signal stream encoder
m_oAlgo1_SignalEncoder.initialize(*this);
m_oAlgo2_SignalEncoder.initialize(*this);
m_oAlgo3_SignalEncoder.initialize(*this);
m_pHilbertAlgo = &this->getAlgorithmManager().getAlgorithm(this->getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_HilbertTransform));
m_pHilbertAlgo->initialize();
ip_pSignal_Matrix.initialize(m_pHilbertAlgo->getInputParameter(OVP_Algorithm_HilbertTransform_InputParameterId_Matrix));
op_pHilbert_Matrix.initialize(m_pHilbertAlgo->getOutputParameter(OVP_Algorithm_HilbertTransform_OutputParameterId_HilbertMatrix));
op_pEnvelope_Matrix.initialize(m_pHilbertAlgo->getOutputParameter(OVP_Algorithm_HilbertTransform_OutputParameterId_EnvelopeMatrix));
op_pPhase_Matrix.initialize(m_pHilbertAlgo->getOutputParameter(OVP_Algorithm_HilbertTransform_OutputParameterId_PhaseMatrix));
ip_pSignal_Matrix.setReferenceTarget(m_oAlgo0_SignalDecoder.getOutputMatrix());
m_oAlgo1_SignalEncoder.getInputSamplingRate().setReferenceTarget(m_oAlgo0_SignalDecoder.getOutputSamplingRate());
m_oAlgo2_SignalEncoder.getInputSamplingRate().setReferenceTarget(m_oAlgo0_SignalDecoder.getOutputSamplingRate());
m_oAlgo3_SignalEncoder.getInputSamplingRate().setReferenceTarget(m_oAlgo0_SignalDecoder.getOutputSamplingRate());
m_oAlgo1_SignalEncoder.getInputMatrix().setReferenceTarget(op_pHilbert_Matrix);
m_oAlgo2_SignalEncoder.getInputMatrix().setReferenceTarget(op_pEnvelope_Matrix);
m_oAlgo3_SignalEncoder.getInputMatrix().setReferenceTarget(op_pPhase_Matrix);
return true;
}
/*******************************************************************************/
boolean CBoxAlgorithmHilbert::uninitialize(void)
{
m_oAlgo0_SignalDecoder.uninitialize();
m_oAlgo1_SignalEncoder.uninitialize();
m_oAlgo2_SignalEncoder.uninitialize();
m_oAlgo3_SignalEncoder.uninitialize();
ip_pSignal_Matrix.uninitialize();
op_pHilbert_Matrix.uninitialize();
op_pEnvelope_Matrix.uninitialize();
op_pPhase_Matrix.uninitialize();
m_pHilbertAlgo->uninitialize();
this->getAlgorithmManager().releaseAlgorithm(*m_pHilbertAlgo);
return true;
}
/*******************************************************************************/
boolean CBoxAlgorithmHilbert::processInput(uint32 ui32InputIndex)
{
// some pre-processing code if needed...
// ready to process !
getBoxAlgorithmContext()->markAlgorithmAsReadyToProcess();
return true;
}
/*******************************************************************************/
boolean CBoxAlgorithmHilbert::process(void)
{
// the static box context describes the box inputs, outputs, settings structures
//IBox& l_rStaticBoxContext=this->getStaticBoxContext();
// the dynamic box context describes the current state of the box inputs and outputs (i.e. the chunks)
IBoxIO& l_rDynamicBoxContext=this->getDynamicBoxContext();
//iterate over all chunk on input 0
for(uint32 i=0; i<l_rDynamicBoxContext.getInputChunkCount(0); i++)
{
// decode the chunk i on input 0
m_oAlgo0_SignalDecoder.decode(0,i);
// the decoder may have decoded 3 different parts : the header, a buffer or the end of stream.
if(m_oAlgo0_SignalDecoder.isHeaderReceived())
{
// Header received
m_pHilbertAlgo->process(OVP_Algorithm_HilbertTransform_InputTriggerId_Initialize);
// Pass the header to the next boxes, by encoding a header on the output 0:
m_oAlgo1_SignalEncoder.encodeHeader(0);
m_oAlgo2_SignalEncoder.encodeHeader(1);
m_oAlgo3_SignalEncoder.encodeHeader(2);
// send the output chunk containing the header. The dates are the same as the input chunk:
l_rDynamicBoxContext.markOutputAsReadyToSend(0, l_rDynamicBoxContext.getInputChunkStartTime(0, i), l_rDynamicBoxContext.getInputChunkEndTime(0, i));
l_rDynamicBoxContext.markOutputAsReadyToSend(1, l_rDynamicBoxContext.getInputChunkStartTime(0, i), l_rDynamicBoxContext.getInputChunkEndTime(0, i));
l_rDynamicBoxContext.markOutputAsReadyToSend(2, l_rDynamicBoxContext.getInputChunkStartTime(0, i), l_rDynamicBoxContext.getInputChunkEndTime(0, i));
}
if(m_oAlgo0_SignalDecoder.isBufferReceived())
{
m_pHilbertAlgo->process(OVP_Algorithm_HilbertTransform_InputTriggerId_Process);
// Encode the output buffer :
m_oAlgo1_SignalEncoder.encodeBuffer(0);
m_oAlgo2_SignalEncoder.encodeBuffer(1);
m_oAlgo3_SignalEncoder.encodeBuffer(2);
// and send it to the next boxes :
l_rDynamicBoxContext.markOutputAsReadyToSend(0, l_rDynamicBoxContext.getInputChunkStartTime(0, i), l_rDynamicBoxContext.getInputChunkEndTime(0, i));
l_rDynamicBoxContext.markOutputAsReadyToSend(1, l_rDynamicBoxContext.getInputChunkStartTime(0, i), l_rDynamicBoxContext.getInputChunkEndTime(0, i));
l_rDynamicBoxContext.markOutputAsReadyToSend(2, l_rDynamicBoxContext.getInputChunkStartTime(0, i), l_rDynamicBoxContext.getInputChunkEndTime(0, i));
}
if(m_oAlgo0_SignalDecoder.isEndReceived())
{
// End of stream received. This happens only once when pressing "stop". Just pass it to the next boxes so they receive the message :
m_oAlgo1_SignalEncoder.encodeEnd(0);
m_oAlgo2_SignalEncoder.encodeEnd(1);
m_oAlgo3_SignalEncoder.encodeEnd(2);
l_rDynamicBoxContext.markOutputAsReadyToSend(0, l_rDynamicBoxContext.getInputChunkStartTime(0, i), l_rDynamicBoxContext.getInputChunkEndTime(0, i));
l_rDynamicBoxContext.markOutputAsReadyToSend(1, l_rDynamicBoxContext.getInputChunkStartTime(0, i), l_rDynamicBoxContext.getInputChunkEndTime(0, i));
l_rDynamicBoxContext.markOutputAsReadyToSend(2, l_rDynamicBoxContext.getInputChunkStartTime(0, i), l_rDynamicBoxContext.getInputChunkEndTime(0, i));
}
// The current input chunk has been processed, and automaticcaly discarded.
// you don't need to call "l_rDynamicBoxContext.markInputAsDeprecated(0, i);"
}
return true;
}
#ifndef __OpenViBEPlugins_BoxAlgorithm_Hilbert_H__
#define __OpenViBEPlugins_BoxAlgorithm_Hilbert_H__
#include "../../ovp_defines.h"
#include <openvibe/ov_all.h>
#include <toolkit/ovtk_all.h>
// The unique identifiers for the box and its descriptor.
// Identifier are randomly chosen by the skeleton-generator.
//#define OVP_ClassId_BoxAlgorithm_Hilbert OpenViBE::CIdentifier(0x7878A47F, 0x9A8FE349)
//#define OVP_ClassId_BoxAlgorithm_HilbertDesc OpenViBE::CIdentifier(0x2DB54E2F, 0x435675EF)
namespace OpenViBEPlugins
{
namespace SignalProcessingBasic
{
/**
* \class CBoxAlgorithmHilbert
* \author Alison Cellard (Inria)
* \date Thu Jun 6 13:47:53 2013
* \brief The class CBoxAlgorithmHilbert describes the box Phase and Envelope.
*
*/
class CBoxAlgorithmHilbert : virtual public OpenViBEToolkit::TBoxAlgorithm < OpenViBE::Plugins::IBoxAlgorithm >
{
public:
virtual void release(void) { delete this; }
virtual OpenViBE::boolean initialize(void);
virtual OpenViBE::boolean uninitialize(void);
virtual OpenViBE::boolean processInput(OpenViBE::uint32 ui32InputIndex);
virtual OpenViBE::boolean process(void);
// As we do with any class in openvibe, we use the macro below
// to associate this box to an unique identifier.
// The inheritance information is also made available,
// as we provide the superclass OpenViBEToolkit::TBoxAlgorithm < OpenViBE::Plugins::IBoxAlgorithm >
_IsDerivedFromClass_Final_(OpenViBEToolkit::TBoxAlgorithm < OpenViBE::Plugins::IBoxAlgorithm >, OVP_ClassId_BoxAlgorithm_Hilbert);
protected:
// Signal stream decoder
OpenViBEToolkit::TSignalDecoder < CBoxAlgorithmHilbert > m_oAlgo0_SignalDecoder;
// Signal stream encoder
OpenViBEToolkit::TSignalEncoder < CBoxAlgorithmHilbert > m_oAlgo1_SignalEncoder;
OpenViBEToolkit::TSignalEncoder < CBoxAlgorithmHilbert > m_oAlgo2_SignalEncoder;
OpenViBEToolkit::TSignalEncoder < CBoxAlgorithmHilbert > m_oAlgo3_SignalEncoder;
OpenViBE::Kernel::IAlgorithmProxy* m_pHilbertAlgo;
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMatrix* > ip_pSignal_Matrix;
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMatrix* > op_pHilbert_Matrix;
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMatrix* > op_pEnvelope_Matrix;
OpenViBE::Kernel::TParameterHandler < OpenViBE::IMatrix* > op_pPhase_Matrix;
};
/**
* \class CBoxAlgorithmHilbertDesc
* \author Alison Cellard (Inria)
* \date Thu Jun 6 13:47:53 2013
* \brief Descriptor of the box Phase and Envelope.
*
*/
class CBoxAlgorithmHilbertDesc : virtual public OpenViBE::Plugins::IBoxAlgorithmDesc
{
public:
virtual void release(void) { }
virtual OpenViBE::CString getName(void) const { return OpenViBE::CString("Hilbert Transform"); }
virtual OpenViBE::CString getAuthorName(void) const { return OpenViBE::CString("Alison Cellard"); }
virtual OpenViBE::CString getAuthorCompanyName(void) const { return OpenViBE::CString("Inria"); }
virtual OpenViBE::CString getShortDescription(void) const { return OpenViBE::CString("Hilbert transform, Phase and Envelope from discrete-time analytic signal using Hilbert"); }
virtual OpenViBE::CString getDetailedDescription(void) const { return OpenViBE::CString("Return Hilbert transform, phase and envelope of the input signal using analytic signal computation"); }
virtual OpenViBE::CString getCategory(void) const { return OpenViBE::CString("Signal processing/Basic"); }
virtual OpenViBE::CString getVersion(void) const { return OpenViBE::CString("1"); }
virtual OpenViBE::CString getStockItemName(void) const { return OpenViBE::CString("gtk-new"); }
virtual OpenViBE::CIdentifier getCreatedClass(void) const { return OVP_ClassId_BoxAlgorithm_Hilbert; }
virtual OpenViBE::Plugins::IPluginObject* create(void) { return new OpenViBEPlugins::SignalProcessingBasic::CBoxAlgorithmHilbert; }
virtual OpenViBE::boolean getBoxPrototype(
OpenViBE::Kernel::IBoxProto& rBoxAlgorithmPrototype) const
{
rBoxAlgorithmPrototype.addInput("Input Signal",OV_TypeId_Signal);
rBoxAlgorithmPrototype.addOutput("Hilbert Transform", OV_TypeId_Signal);
rBoxAlgorithmPrototype.addOutput("Envelope",OV_TypeId_Signal);
rBoxAlgorithmPrototype.addOutput("Phase",OV_TypeId_Signal);
rBoxAlgorithmPrototype.addFlag(OpenViBE::Kernel::BoxFlag_IsUnstable);
return true;
}
_IsDerivedFromClass_Final_(OpenViBE::Plugins::IBoxAlgorithmDesc, OVP_ClassId_BoxAlgorithm_HilbertDesc);
};
};
};
#endif // __OpenViBEPlugins_BoxAlgorithm_Hilbert_H__
......@@ -80,6 +80,20 @@
#define OVP_Algorithm_ARBurgMethod_InputTriggerId_Process OpenViBE::CIdentifier(0xBEEBBE84, 0x4F14F8F8)
#define OVP_Algorithm_ARBurgMethod_OutputTriggerId_ProcessDone OpenViBE::CIdentifier(0xA5AAD435, 0x9EC3DB80)
#define OVP_ClassId_Algorithm_HilbertTransform OpenViBE::CIdentifier(0x344B79DE, 0x89EAAABB)
#define OVP_ClassId_Algorithm_HilbertTransformDesc OpenViBE::CIdentifier(0x8CAB236A, 0xA789800D)
#define OVP_Algorithm_HilbertTransform_InputParameterId_Matrix OpenViBE::CIdentifier(0xC117CE9A, 0x3FFCB156)
#define OVP_Algorithm_HilbertTransform_OutputParameterId_HilbertMatrix OpenViBE::CIdentifier(0xDAE13CB8, 0xEFF82E69)
#define OVP_Algorithm_HilbertTransform_OutputParameterId_EnvelopeMatrix OpenViBE::CIdentifier(0x9D0A023A, 0x7690C48E)
#define OVP_Algorithm_HilbertTransform_OutputParameterId_PhaseMatrix OpenViBE::CIdentifier(0x495B55E2, 0x8CAAC08E)
#define OVP_Algorithm_HilbertTransform_InputTriggerId_Initialize OpenViBE::CIdentifier(0xE4B3CB4A, 0xF0121A20)
#define OVP_Algorithm_HilbertTransform_InputTriggerId_Process OpenViBE::CIdentifier(0xC3DC087D, 0x4AAFC1F0)
#define OVP_Algorithm_HilbertTransform_OutputTriggerId_ProcessDone OpenViBE::CIdentifier(0xB0B2A2DD, 0x73529B46)
#define OVP_ClassId_BoxAlgorithm_Hilbert OpenViBE::CIdentifier(0x7878A47F, 0x9A8FE349)
#define OVP_ClassId_BoxAlgorithm_HilbertDesc OpenViBE::CIdentifier(0x2DB54E2F, 0x435675EF)
//___________________________________________________________________//
// //
// Plugin Object Descriptor Class Identifiers //
......
......@@ -18,6 +18,9 @@
#include "box-algorithms/spectral-analysis/ovpCBoxAlgorithmFrequencyBandSelector.h"
#include "box-algorithms/spectral-analysis/ovpCBoxAlgorithmSpectrumAverage.h"
#include "box-algorithms/basic/ovpCBoxAlgorithmHilbert.h"
#include "algorithms/basic/ovpCHilbertTransform.h"
#include "box-algorithms/ovpCTimeBasedEpoching.h"
#include "box-algorithms/ovpCReferenceChannel.h"
#include "box-algorithms/ovpCChannelSelector.h"
......@@ -109,4 +112,17 @@ OVP_Declare_Begin()
OVP_Declare_New(OpenViBEPlugins::SignalProcessingGpl::CAlgorithmARBurgMethodDesc);
#endif
#ifdef __OpenViBEPlugins_BoxAlgorithm_ConnectivityMeasure_H__
OVP_Declare_New(OpenViBEPlugins::SignalProcessing::CBoxAlgorithmConnectivityMeasureDesc)
#endif
#ifdef __OpenViBEPlugins_Algorithm_HilbertTransform_H__
OVP_Declare_New(OpenViBEPlugins::SignalProcessing::CAlgorithmHilbertTransformDesc)
#endif
#ifdef __OpenViBEPlugins_Algorithm_SingleTrialPhaseLockingValue_H__
OVP_Declare_New(OpenViBEPlugins::SignalProcessing::CAlgorithmSingleTrialPhaseLockingValueDesc)
#endif
OVP_Declare_New(OpenViBEPlugins::SignalProcessingBasic::CBoxAlgorithmHilbertDesc)
OVP_Declare_End()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment