Skip to content

Python library to read PicoQuant PTU files (raw TTTR data) as well as build FLIM image

License

Notifications You must be signed in to change notification settings

SumeetRohilla/readPTU_FLIM

Repository files navigation

readPTU_FLIM Library

For demo: Jupyter Notebook to work with PicoQuant PTU files

The library provides the capability to handle all PicoQuant's TCSPC Harps in T2 as well as T3 mode.

  • PicoQuant uses a bespoke file format called PTU to store data from time-tag-time-resolved (TTTR) measurements.
  • Current file format (.ptu) and is subsequent to the former .pt2 or .pt3 and can handle both T2 and T3 acquisition modes for a variety of TCSPC devices (MultiHarp, HydraHarp, TimeHarp, PicoHarp, etc.)
  • At the moment, the library was tested for FLIM data obtained using MultiHarp, HydraHarp and PicoHarp.

What is not available !

  • Option to save data after processing.

!!! Help is only an email away for MATLAB implementation of the same library.

Dependencies

readPTU_FLIM.py, numpy, matplotlib, numba,

from readPTU_FLIM import PTUreader 
import numpy as np from matplotlib 
import pyplot as plt

Use case

  • As an example, first we import the readPTU_FLIM library. Then we should open the PTU file using a PTUreader() object. By constructing a PTUreader() object, automatically opens the file, reads the PTU file header and TTTR data in raw format. PTU file header contains important measurement information (PQ TCSPC unit, laser/pulse sync rate, FLIM record type, scanner type, etc.)

  • Test_FLIM_image_daisyPollen_PicoHarp_2.ptu
    Download the test file here FLIM data was acquired using a PicoHarp (T3 mode)
    Exctiation Laser light: 485 nm
    Number of Detection Channels: 2

  • At the moment, PTUreader library contains implementation for reading imaging data from scanner types:
    • laser beam scanner (LSM)
    • Piezo scanner

Select a PTU file

ptu_file  = PTUreader('Test_FLIM_image_daisyPollen_PicoHarp_2.ptu', print_header_data = False)

How to access raw data from ptu_file object?

# # Raw data can be accessed using ptu_file object
# sync    = ptu_file.sync    # Macro photon arrival time
# tcspc   = ptu_file.tcspc   # Micro photon arrival time (tcspc time bin resoultion)
# channel = ptu_file.channel # Detection channel of tcspc unit (<=8 for PQ hardware in 2019)
# special = ptu_file.special # Special event markers, for e.g. Frame, LineStart, LineStop, etc.

Get flim_data_stack and intensity_image from raw TTTR data

Note: once NEXT CODE block is executed raw TTTR data variables (sync, tcspc, channel, special) are deleted

  • flim_data_stack: (pixX, pixY, spectral_detection_channel, tcspc_bins)
  • intensity_image: (pixX, pixY)

For example: How to get all the tcspc histogram data from all pixels from spectral detection channel 1? (hint below!)

flim_data_stack, intensity_image = ptu_file.get_flim_data_stack()
# channel_1_data = flim_data_stack[:,:,0,:]

Plot Intensity image

# %matplotlib inline
# #plot intensity image
# plt.imshow(intensity_image)
# plt.colorbar()

Plot & Play ▶

  • Please see Jupyter notebook for implementation
  • Once the FLIM data stack is loaded, one could create custom gui for performing all sort of FLIM analysis routines as needed.
  • As an example a simple intensity image is plotted
  • User can investigate the fluorescence decays after drawing a rectangle on the intensity image
    Interactive Demo Snapshot

Updates

  • 27 Aug, 2019: Piezo Scanner data readability added to the library

About

Python library to read PicoQuant PTU files (raw TTTR data) as well as build FLIM image

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published