diff --git a/Builds/VisualStudio2012/open-ephys.sln b/Builds/VisualStudio2012/open-ephys.sln index 61074c0e04aebb4f1d48dd95b47ccd0a86ed9f09..520a8d855d09a997cfccb769049bb0e4c270ef34 100644 --- a/Builds/VisualStudio2012/open-ephys.sln +++ b/Builds/VisualStudio2012/open-ephys.sln @@ -1,21 +1,29 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 -Project("{5A05F353-1D63-394C-DFB0-981BB2309002}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}" +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/RecordNode/HDF5FileFormat.cpp b/Source/Processors/RecordNode/HDF5FileFormat.cpp index 62a7466c5079695a0dd4ffd445d506e9ed1eec26..0e1d1e2c3c83482a08355566cc0fa0b778a5413f 100644 --- a/Source/Processors/RecordNode/HDF5FileFormat.cpp +++ b/Source/Processors/RecordNode/HDF5FileFormat.cpp @@ -117,6 +117,12 @@ void HDF5FileBase::close() } int HDF5FileBase::setAttribute(DataTypes type, void* data, String path, String name) +{ + return setAttributeArray(type, data, 1, path, name); +} + + +int HDF5FileBase::setAttributeArray(DataTypes type, void* data, int size, String path, String name) { Group loc; Attribute attr; @@ -131,6 +137,13 @@ int HDF5FileBase::setAttribute(DataTypes type, void* data, String path, String n H5type = getH5Type(type); origType = getNativeType(type); + if (size > 1) + { + hsize_t dims = size; + H5type = ArrayType(H5type,1,&dims); + origType = ArrayType(origType,1,&dims); + } + if (loc.attrExists(name.toUTF8())) { attr = loc.openAttribute(name.toUTF8()); @@ -605,6 +618,8 @@ void KWDFile::startNewRecording(int recordingNumber, int nChannels, HDF5Recordin // CHECK_ERROR(setAttribute(U32,&(info->start_sample),recordPath,String("start_sample"))); CHECK_ERROR(setAttribute(F32,&(info->sample_rate),recordPath,String("sample_rate"))); CHECK_ERROR(setAttribute(U32,&(info->bit_depth),recordPath,String("bit_depth"))); + CHECK_ERROR(createGroup(recordPath+"/application_data")); + CHECK_ERROR(setAttributeArray(F32,info->bitVolts.getRawDataPointer(),info->bitVolts.size(),recordPath+"/application_data",String("channel_bit_volts"))); recdata = createDataSet(I16,0,nChannels,CHUNK_XSIZE,recordPath+"/data"); if (!recdata.get()) std::cerr << "Error creating data set" << std::endl; diff --git a/Source/Processors/RecordNode/HDF5FileFormat.h b/Source/Processors/RecordNode/HDF5FileFormat.h index 1fc8e675fb5d9c5d9dae130ec4fc0317e5f14f86..c228647ef344a5565f75474ee3229daed6e79a5c 100644 --- a/Source/Processors/RecordNode/HDF5FileFormat.h +++ b/Source/Processors/RecordNode/HDF5FileFormat.h @@ -41,6 +41,7 @@ struct HDF5RecordingInfo uint32 start_sample; float sample_rate; uint32 bit_depth; + Array<float> bitVolts; }; class HDF5FileBase @@ -64,6 +65,7 @@ protected: int setAttribute(DataTypes type, void* data, String path, String name); int setAttributeStr(String value, String path, String name); + int setAttributeArray(DataTypes type, void* data, int size, String path, String name); int createGroup(String path); HDF5RecordingData* getDataSet(String path); diff --git a/Source/Processors/RecordNode/HDF5Recording.cpp b/Source/Processors/RecordNode/HDF5Recording.cpp index 31ad28329d580eeb6cdf83c24ed47717b1052b72..d128b08b817e7a95ee431f921d3792e089d37727 100644 --- a/Source/Processors/RecordNode/HDF5Recording.cpp +++ b/Source/Processors/RecordNode/HDF5Recording.cpp @@ -54,7 +54,7 @@ void HDF5Recording::registerProcessor(GenericProcessor* proc) info->bit_depth = 16; infoArray.add(info); fileArray.add(new KWDFile()); - activeChannelCount.add(0); + bitVoltsArray.add(new Array<float>); processorIndex++; } @@ -62,7 +62,7 @@ void HDF5Recording::resetChannels() { processorIndex = -1; fileArray.clear(); - activeChannelCount.clear(); + bitVoltsArray.clear(); processorMap.clear(); infoArray.clear(); if (spikesFile) @@ -103,7 +103,7 @@ void HDF5Recording::openFiles(File rootFolder, int experimentNumber, int record fileArray[index]->initFile(getChannel(i)->nodeId,basepath); fileArray[index]->open(); } - activeChannelCount.set(index,activeChannelCount[index]+1); + bitVoltsArray[index]->add(getChannel(i)->bitVolts); } } for (int i = 0; i < fileArray.size(); i++) @@ -116,7 +116,8 @@ void HDF5Recording::openFiles(File rootFolder, int experimentNumber, int record infoArray[i]->name = String("Open-Ephys Recording #") + String(recordingNumber); infoArray[i]->start_time = timestamp; infoArray[i]->start_sample = 0; - fileArray[i]->startNewRecording(recordingNumber,activeChannelCount[i],infoArray[i]); + infoArray[i]->bitVolts.addArray(*bitVoltsArray[i]); + fileArray[i]->startNewRecording(recordingNumber,bitVoltsArray[i]->size(),infoArray[i]); } } } @@ -131,7 +132,7 @@ void HDF5Recording::closeFiles() { fileArray[i]->stopRecording(); fileArray[i]->close(); - activeChannelCount.set(i,0); + bitVoltsArray[i]->clear(); } } diff --git a/Source/Processors/RecordNode/HDF5Recording.h b/Source/Processors/RecordNode/HDF5Recording.h index 50a2657348bbac75fcdec3f8f1a21924b932fffc..9be5e3942929b93014826b0f7b6f1a474075e5d7 100644 --- a/Source/Processors/RecordNode/HDF5Recording.h +++ b/Source/Processors/RecordNode/HDF5Recording.h @@ -51,7 +51,7 @@ private: int processorIndex; Array<int> processorMap; - Array<int> activeChannelCount; + OwnedArray<Array<float>> bitVoltsArray; OwnedArray<KWDFile> fileArray; OwnedArray<HDF5RecordingInfo> infoArray; ScopedPointer<KWIKFile> mainFile;