File Exchange

image thumbnail


version (11.4 KB) by Omri Bar-Elli
Convert PTU files to matlab structure variable


Updated 15 Jan 2018

View Version History

View License

The function reads a PTU file created by a HydraHarp TCSPC device (PicoQuant device) and converts it to matlab structure called output. It runs ~100x faster than the demo version it is based on enabling real-time monitoring and analysis.

Cite As

Omri Bar-Elli (2020). Read_PTU_V1(filepath) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)


Omri Bar-Elli

I'm not familiar with the term Timetag and Truetime from the PicoHarp.
If I understand correctly, your measurement should only include one time stamp (Timetag) vs. two in TTTR mode (dtime and sync). and then, only the number of photons per time bin (Timetag?). Thus giving you the decay curve for every pixel. In short, this function is not for you. Sorry.

So this would mean that to get the time axis you have to multiply the bin number (and not the value in Timetag) by the resolution to get the time axis.
A way to confirm this is to count the number of Timetag you have and multiply by the resolution. This should be equal to the trigger period (1/sync).
Could Truetime be something than the conversion from Timetag? Maybe plot the histograms of Timetag and Truetime and see if they are different.
Also, I would suggest using Matlab (or Python) rather than excel if possible
In any case, I never worked with FLIM data so probably best ask Pico Quant for help.

Zachary Hallenbeck

It's a FLIM image from PicoHarp so I'm realizing now that this code won't work for it. I have however been using the original code that takes longer, and trying to understand the output file by viewing it in microsoft excel. I assume the output files are similar between the two programs, and I'm a little confused about the time stamping; my resolution is 16 ps, but that does not seem to be the conversion factor between the Timetag and Truetime (it's more like 51). Do you know why this might be?
Also my pixel dwell time was set at 6.1 ms, but the Truetime between each pixel marker is more like ~3.4 ms, which does not make sense to me unless the factor of 2 is due to the sync divider being set at 2 (and then I wonder if every value is off by a factor of 2?).

Omri Bar-Elli

I have never tried with a FLIM image. Is it produced by a HydraHarp?
For TTTR mode the "output struct" has all the file headings (measurement and device parameters and such), and the time stamp of the counted photons in the following manner:
ph_sync is the number of sync triggers since the beginning of the measurement (use the sync value from the headers to convert to seconds).
ph_dtime is the time bin since the last sync (trigger), use the resolution value from the headers to convert to seconds.
ph_channel is the channel in which the photon was detected.
the same info is saved from markers in mark_sync, mark_dtime and mark_channel.
Perhaps you can share a file and I can try? Feel free to email me

Zachary Hallenbeck

Could you comment on what information the output file holds? For a FLIM image is it an array with average lifetime and intensity values at each pixel? If not is there a way to extract this data directly from a .ptu file in matlab as an array to be analyzed?

Omri Bar-Elli

I never tried with a picoharp 300 but it should work, note that this only works for TTTR mode. Let me know if it doesn't work maybe I can adjust it.

Trinh Cong Tai

Is it posible to read PTU created by picoharp 300?

Omri Bar-Elli

These files are typically quite big. Any .ptu file produced by a HH with the latest firmware in TTTR mode should work.

Liangyu Qiu

May you give me a sample file to test this file?

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!