track_droplets#

This code is intended for tracking droplets using cv2.HoughCircle() algorithm.

Algorithm

  • Run cv2.HoughCircle() with parameters in hough_params.json in the analysis_folder

  • if number_of_circle_found > 0, then process next image frame

  • else if number_of_circle_found == 0, increase param1 (not implemented)
    • if no particle is found after 5 iterations, save x, y as np.nan and skip

Syntax

python track_droplets.py analysis_folder nd2Dir
  • analysis_folder – folder to retrieve hough circle parameters hough_params.json, and to save trajectory results

  • nd2Dir – directory of .nd2 raw image

Test

python track_droplets.py test_images rack_droplets test_images       est.nd2 

Edit

  • Jan 05, 2023 – Adapt myimagelib import style.

  • Feb 08, 2023 – Rewrite in function wrapper form, to make autodoc work properly. (autodoc import the script and execute it, so anything outside if __name__=="__main__" will be executed, causing problems)

  • Mar 09, 2023 – (i) Use .nd2 as input image, (ii) do not save cropped images, instead generate a report, (iii) I’m trying to generate a real time report using matplotlib, but the performance was an issue. The plot window freezes, and the tracking efficiency decays over time. Therefore, I disable this report system and postpone the development to the future.

  • Mar 14, 2023 – Remove the link step: link trajectories by nature is highly interactive, because one needs to actively check if the cutoff distance is chosen properly so that we don’t miss detected particles with the filtering.