From 0930455f83734a219abba78f1454035857fe31cc Mon Sep 17 00:00:00 2001 From: Aaron Cuevas Lopez <aacuelo@teleco.upv.es> Date: Tue, 7 Mar 2017 00:06:56 +0100 Subject: [PATCH] Add unit field to data channel objects --- Builds/VisualStudio2013/open-ephys.sln | 20 ++++++++++++++----- Source/Processors/Channel/InfoObjects.cpp | 10 ++++++++++ Source/Processors/Channel/InfoObjects.h | 7 +++++++ Source/Processors/DataThreads/DataThread.cpp | 7 ++++++- Source/Processors/DataThreads/DataThread.h | 2 ++ .../DataThreads/RhythmNode/RHD2000Thread.cpp | 13 ++++++++++++ .../DataThreads/RhythmNode/RHD2000Thread.h | 2 ++ Source/Processors/SourceNode/SourceNode.cpp | 7 +++++++ 8 files changed, 62 insertions(+), 6 deletions(-) diff --git a/Builds/VisualStudio2013/open-ephys.sln b/Builds/VisualStudio2013/open-ephys.sln index 59a9d10ba..8387e176d 100644 --- a/Builds/VisualStudio2013/open-ephys.sln +++ b/Builds/VisualStudio2013/open-ephys.sln @@ -1,21 +1,31 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -Project("{5A05F353-1D63-394C-DFB0-981BB2309002}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}" +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 + Debug|x64 = Debug|x64 + Debug64|Win32 = Debug64|Win32 Debug64|x64 = Debug64|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + Release64|Win32 = Release64|Win32 Release64|x64 = Release64|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|Win32.ActiveCfg = Debug|Win32 {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|Win32.Build.0 = Debug|Win32 - {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.ActiveCfg = Release|Win32 - {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.Build.0 = Release|Win32 + {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|x64.ActiveCfg = Debug|Win32 + {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|Win32.ActiveCfg = Debug64|x64 {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|x64.ActiveCfg = Debug64|x64 {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|x64.Build.0 = Debug64|x64 + {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.ActiveCfg = Release|Win32 + {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.Build.0 = Release|Win32 + {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|x64.ActiveCfg = Release|Win32 + {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|Win32.ActiveCfg = Release64|x64 {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|x64.ActiveCfg = Release64|x64 {9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|x64.Build.0 = Release64|x64 EndGlobalSection diff --git a/Source/Processors/Channel/InfoObjects.cpp b/Source/Processors/Channel/InfoObjects.cpp index aa88810f0..4e33c8e2e 100644 --- a/Source/Processors/Channel/InfoObjects.cpp +++ b/Source/Processors/Channel/InfoObjects.cpp @@ -179,6 +179,16 @@ float DataChannel::getBitVolts() const return m_bitVolts; } +void DataChannel::setDataUnits(String unit) +{ + m_unitName = unit; +} + +String DataChannel::getDataUnits() const +{ + return m_unitName; +} + DataChannel::DataChannelTypes DataChannel::getChannelType() const { return m_type; diff --git a/Source/Processors/Channel/InfoObjects.h b/Source/Processors/Channel/InfoObjects.h index 264cccae7..c16e3d117 100644 --- a/Source/Processors/Channel/InfoObjects.h +++ b/Source/Processors/Channel/InfoObjects.h @@ -201,6 +201,12 @@ public: /** Returns the bitVolts value for this channel. */ float getBitVolts() const; + /** Sets the unit string */ + void setDataUnits(String unit); + + /** Gets the data units*/ + String getDataUnits() const; + DataChannelTypes getChannelType() const; //--------- STATUS METHODS ----------// @@ -235,6 +241,7 @@ private: bool m_isEnabled{ true }; bool m_isMonitored{ false }; bool m_isRecording{ false }; + String m_unitName{ "uV" }; JUCE_LEAK_DETECTOR(DataChannel); }; diff --git a/Source/Processors/DataThreads/DataThread.cpp b/Source/Processors/DataThreads/DataThread.cpp index 62ffc3ef3..099af80ee 100755 --- a/Source/Processors/DataThreads/DataThread.cpp +++ b/Source/Processors/DataThreads/DataThread.cpp @@ -141,4 +141,9 @@ void DataThread::createExtraEvents(Array<EventChannel*>&) {} void DataThread::resizeBuffers() -{} \ No newline at end of file +{} + +String DataThread::getChannelUnits(int chanIndex) const +{ + return String::empty; +} \ No newline at end of file diff --git a/Source/Processors/DataThreads/DataThread.h b/Source/Processors/DataThreads/DataThread.h index e0c03f6d8..f81678c40 100755 --- a/Source/Processors/DataThreads/DataThread.h +++ b/Source/Processors/DataThreads/DataThread.h @@ -137,6 +137,8 @@ public: void createTTLChannels(); + virtual String getChannelUnits(int chanIndex) const; + protected: virtual void setDefaultChannelNames(); diff --git a/Source/Processors/DataThreads/RhythmNode/RHD2000Thread.cpp b/Source/Processors/DataThreads/RhythmNode/RHD2000Thread.cpp index 2ccaad9e3..326b8951d 100644 --- a/Source/Processors/DataThreads/RhythmNode/RHD2000Thread.cpp +++ b/Source/Processors/DataThreads/RhythmNode/RHD2000Thread.cpp @@ -929,6 +929,19 @@ int RHD2000Thread::getNumDataOutputs(DataChannel::DataChannelTypes type, int sub } } +String RHD2000Thread::getChannelUnits(int chanIndex) const +{ + switch (sn->getDataChannel(chanIndex)->getChannelType()) + { + case DataChannel::AUX_CHANNEL: + return "mV"; + case DataChannel::ADC_CHANNEL: + return "V"; + default: + return "uV"; + } +} + int RHD2000Thread::getNumTTLOutputs(int subproc) const { diff --git a/Source/Processors/DataThreads/RhythmNode/RHD2000Thread.h b/Source/Processors/DataThreads/RhythmNode/RHD2000Thread.h index 1534a9cb9..566363a9a 100644 --- a/Source/Processors/DataThreads/RhythmNode/RHD2000Thread.h +++ b/Source/Processors/DataThreads/RhythmNode/RHD2000Thread.h @@ -126,6 +126,8 @@ public: String getChannelName (int ch) const; void setNumChannels (int hsNum, int nChannels); + String getChannelUnits(int chanIndex) const override; + int getHeadstageChannels (int hsNum) const; int getActiveChannelsInHeadstage (int hsNum) const; diff --git a/Source/Processors/SourceNode/SourceNode.cpp b/Source/Processors/SourceNode/SourceNode.cpp index 16b0111a2..53e7842b5 100755 --- a/Source/Processors/SourceNode/SourceNode.cpp +++ b/Source/Processors/SourceNode/SourceNode.cpp @@ -109,6 +109,13 @@ void SourceNode::updateSettings() { dataThread->updateChannels(); resizeBuffers(); + int nChans = dataChannelArray.size(); + for (int i = 0; i < nChans; i++) + { + String unit = dataThread->getChannelUnits(i); + if (unit.isNotEmpty()) + dataChannelArray[i]->setDataUnits(unit); + } } } -- GitLab