Skip to content
Snippets Groups Projects
Commit fbc77a51 authored by Aaron Cuevas Lopez's avatar Aaron Cuevas Lopez
Browse files

Add options to open-ephys format to rename files based on channel order

parent 7088405a
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@
#include "Channel.h"
Channel::Channel(GenericProcessor* p, int n, ChannelType t) : index(n), processor(p), type(t), nodeIndex(0)
Channel::Channel(GenericProcessor* p, int n, ChannelType t) : index(n), processor(p), type(t), nodeIndex(0), mappedIndex(n)
{
reset();
}
......@@ -54,6 +54,7 @@ Channel::Channel(const Channel& ch)
{
index = ch.index;
nodeIndex = ch.nodeIndex;
mappedIndex = ch.mappedIndex;
nodeId = ch.nodeId;
processor = ch.processor;
sampleRate = ch.sampleRate;
......
......@@ -111,6 +111,9 @@ public:
/** Channel index within the source processor relative to channel type */
int index;
/** Channel index which can be altered by the processor, useful with remappers*/
int mappedIndex;
/** The ID of the channel's processor.*/
int nodeId;
......
......@@ -80,6 +80,7 @@ void ChannelMappingNode::updateSettings()
{
if (enabledChannelArray[channelArray[i]])
{
oldChannels[channelArray[i]]->mappedIndex = settings.numOutputs;
channels.add(oldChannels[channelArray[i]]);
oldChannels.set(channelArray[i],nullptr,false);
settings.numOutputs++;
......
......@@ -333,6 +333,7 @@ void GenericProcessor::update()
Channel* ch = new Channel(*sourceChan);
ch->setProcessor(this);
ch->nodeIndex = i;
ch->mappedIndex = i;
if (i < recordStatus.size())
{
......
......@@ -253,7 +253,10 @@ String OriginalRecording::getFileName(Channel* ch)
filename += ch->nodeId;
filename += "_";
filename += ch->name;
if (renameFiles)
filename += renamedPrefix + String(ch->mappedIndex + 1);
else
filename += ch->name;
if (experimentNumber > 1)
{
......@@ -698,6 +701,8 @@ void OriginalRecording::writeXml()
void OriginalRecording::setParameter(EngineParameter& parameter)
{
boolParameter(0, separateFiles);
boolParameter(1, renameFiles);
strParameter(2, renamedPrefix);
}
RecordEngineManager* OriginalRecording::getEngineManager()
......@@ -706,5 +711,9 @@ RecordEngineManager* OriginalRecording::getEngineManager()
EngineParameter* param;
param = new EngineParameter(EngineParameter::BOOL,0,"Separate Files",false);
man->addParameter(param);
param = new EngineParameter(EngineParameter::BOOL, 1, "Rename files based on channel order", false);
man->addParameter(param);
param = new EngineParameter(EngineParameter::STR, 2, "Renamed files prefix", "CH");
man->addParameter(param);
return man;
}
\ No newline at end of file
......@@ -82,6 +82,9 @@ private:
int recordingNumber;
int experimentNumber;
bool renameFiles;
String renamedPrefix;
/** Holds data that has been converted from float to int16 before
saving.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment