From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Axon ABF & ABF2 Files

.abf files are generated by Molecular Devices pClamp software, widely used in electrophysiology.
ABF1.8 format can be read by some old piece of code, but Molecular Devices introduced the ABF2 format, which can not be read this way. Molecular Devices now furnishes a dll to programmers wanting to open their files, but Labview is quite clumsy when working with dlls (or at least, I could not make it work this way).

I have been stucked with this problem for some years, and I finally could find and modify a VI reading the abf binaries. I do not mind to share the code freely, but the original work is made by Ivan Pierre Cohen (I modified and cleaned the code, but most of the reverse-engineering of the binaries was made by him). I am unable to contact him, so I protected the VIs before distribution.


In the llb, "Read Abf Header" and "Create Abf Description" do not have a block diagram, for protection. The Vis "Extract Abf Sweeps" and "Open ABF File" are readable and will show you how to extract the data from the Header and the Description. You can start with "Open ABF File".

Clipboard-ABF.jpg


These VIs:
* Can read either ABF1.8 or ABF2 files.
* Support Integer16 and Float32 formats.
* Extract any number of Sweeps, and any number of Channels (well, actually I limited it to 4 channels in the "Extract Abf Sweeps" Vi, because I never needed more and there is a strange bug. See after.)
* Have a basic Error management (checking if the file is indeed a .abf and if protocol is suported).

* Can only read Little-Indian Files.
* Can only read Gap-Free or Fixed Length protocols (every sweep must have the same length).
* Do not support different time sampling: every channel must have the same acquisition frequency.
* Do not extract protocols, waveform, triggers, etc...

Known bugs :
* With abf file containing more than 4 channels, some files seem to have a different channel order. Amplification factors and channel data are stored separately and for an unknown reason, channels might be rotated in a seemingly random way. For example, Amplification factors are stored in the 1-2-3-4-5 order but for some files channels will be stored in 2-3-4-5-1 or 3-4-5-1-2 order. So data is extracted but values will be messed up. This happens only for abf files with more than 4 channels and I have no idea why (memory management? Hard drive access?). If you remove manually a channel (with ClampFit, for example) and save it to another abf file, everything is normal. To change the number of channel extracted is really easy (see the vi) but use it carefully.

The llb is in Labview 2017, 64 bits format. Please do tell me if anything is wrong or could be improved.

0 Kudos
Message 1 of 9
(4,805 Views)
Dear Sylvain: That should be helpful. However, my labview version is old. Do you mind providing a Labview 2015 compatible version for me for a quick trial.  I guess another issue that I may have (havent tried yet) is that my file size is normally quite big (>100 Mb) due to high sampling rate. It may cause out of memory issues when opened using the old ABF reader VI. 
0 Kudos
Message 2 of 9
(4,744 Views)

Dear Shuonju, here is the llb recompiled for Labview12, I should have thought about the version.
I can open files of 140 Mb without any problem with this VI, it should be ok. But it is true that I open the whole file, so size could become an issue. You can check in the "Extract Abf Sweeps" Vi : Data chunk are identified by an offset and a packetsize. And multiple sweeps recordings will have a different offset for each sweep, which allows to open only the desired sweep. This could help a lot for really big files.

0 Kudos
Message 3 of 9
(4,740 Views)

Dear Sylvain:

 

Thanks for your kind help. However, still I can not open your provided VI LLB. I am using Labview 2015 version, which I guess it is of VI 15.0 version. 

 

Did you use "save for previous version" option in LabView?

 

Hope you can provide a version that I can open and use. Cant wait to program my own VI to deal with my Axon data...

 

Many thanks

0 Kudos
Message 4 of 9
(4,726 Views)

Hello Shuonju,

I saved the whole project in Labview 12 format (Yes, with the "Save for previous Version" tool), it should work with Labview 15. Anyway, here it is again for LV15. I will try it with older version of Labview, but I do not have one for the moment.

0 Kudos
Message 5 of 9
(4,721 Views)

This is fabulous, just what I was looking for! THANKS a ton!

0 Kudos
Message 6 of 9
(4,425 Views)

Thanks. Actually I forgot to correct this post: I discovered a mistake in my program, which was introducing a slight shift when reading multiple sweeps. And as the previous archive I gave was compiled, it was not possible to be used by 32bits Labview users.

Here is a corrected version for 32bits & 64bits users, please use this one.

0 Kudos
Message 7 of 9
(4,419 Views)

Hi Sylvain,

 

Thanks a lot for your help on .abf file reader. I have an issue with opening the files, I have LV 2015 version and unable to open any of the files attached in your previous post. Any idea what could be the problem?

 

Thanks in advance.

0 Kudos
Message 8 of 9
(4,271 Views)

Dear Sylvain: Thanks for your code. It works well. The only problem is, when I need to deal with large file sizes. Actually not quite large but say 200 Mb an abf file. It reports not enough memory errors. I think 200 Mb is far less than the actual RAM of my computer. 

 

How you could deal with this issue? I imagine at somewhere in the code, I can split the reading into different proportions? Or there might be an option in LabVIEW which allows more memory uses for this program?

 

But anyway, your code definitely works with ABF 2 files, which is really helpful. 

0 Kudos
Message 9 of 9
(3,287 Views)