public AbfInfo(string abfFilePath, ABFFIOstructs.ABFFileHeader header) { filePath = System.IO.Path.GetFullPath(abfFilePath); fileName = System.IO.Path.GetFileName(abfFilePath); id = System.IO.Path.GetFileNameWithoutExtension(abfFilePath); fileSize = new System.IO.FileInfo(abfFilePath).Length; fileSizeMb = (double)fileSize / 1e6; if (header.fADCSequenceInterval == 0) { throw new Exception("abf header hasn't been properly initialized"); } sampleRate = (int)(1e6 / header.fADCSequenceInterval); pointsPerMs = (double)sampleRate / 1000; channelCount = header.nADCNumChannels; sweepCount = header.lActualEpisodes; sweepLengthPoints = header.lNumSamplesPerEpisode / channelCount; sweepLengthSec = (double)sweepLengthPoints / sampleRate; sweepLengthMin = sweepLengthSec / 60; sweepIntervalSec = header.fEpisodeStartToStart; if (sweepIntervalSec == 0) { sweepIntervalSec = sweepLengthSec; } sweepIntervalMin = sweepIntervalSec / 60; totalLengthSec = sweepIntervalSec * sweepCount; totalLengthMin = totalLengthSec / 60; totalLengthPoints = sweepLengthPoints * sweepCount; tagCount = header.lNumTagEntries; tags = new Tag[tagCount]; protocolFilePath = header.sProtocolPath.Trim(); if (protocolFilePath == "(untitled)") { protocolFilePath = ""; } protocol = System.IO.Path.GetFileNameWithoutExtension(protocolFilePath); }
private static extern bool ABF_ReadChannel(Int32 nFile, ref ABFFIOstructs.ABFFileHeader pFH, Int32 nChannel, Int32 dwEpisode, ref float pfBuffer, ref UInt32 puNumSamples, ref Int32 pnError);
private static extern bool ABF_ReadTags(Int32 nFile, ref ABFFIOstructs.ABFFileHeader pFH, UInt32 dwFirstTag, ref ABFFIOstructs.ABFTag[] pTagArray, UInt32 uNumTags, ref Int32 pnError);
private static extern bool ABF_ReadOpen(String szFileName, ref Int32 phFile, UInt32 fFlags, ref ABFFIOstructs.ABFFileHeader pFH, ref UInt32 puMaxSamples, ref UInt32 pdwMaxEpi, ref Int32 pnError);