LucasJacquier / LumIn-microscopie-fluorescence

GNU General Public License v3.0
1 stars 1 forks source link

LumIn-microscopie-fluorescence

Installation

The packages to install can be found in requirements.txt.

Load data

from pathlib import Path
from load_data import load_data

filepath = Path(...)  # path to the .tiff or .tif file
color_sequence = 'RG'  # means :[Red frame, Green frame, Red frame, ...]

# red_film and green_film are of shape (n_frames, n_rows, n_columns).
movie_dict = load_data(filepath, color_sequence)

movie_dict["R"]  # array of shape (n_red_frames, n_rows, n_cols)
movie_dict["G"]  # array of shape (n_green_frames, n_rows, n_cols)

# display a frame
frame = movie_dict["G"][10]
plt.imshow(frame, cmap="gray")
plt.show()

Example of a frame (from our data : EMCV1_0524_1RRL, red, 11th frame)

initial_image_print_with_plt

Detect particles

Detection and elimination of the background

First, it is needed to calculate the background

from background_estimation import all
#N'importer que la fonction utile et pas all
#Pas besoin d'importer numpy et pandas aussi

averaged_movie_img = calculate_local_average(movie_dict["R"], 10)

averaged_movie_img #One specific frame of movie_dict['color'], with averaged pixel value (here it is the frame 10 from the red movie)

Example on an averaged image

calculate_local_average_Print_with_plt

Then, it is possible to eliminate the background The first method is a substraction

background_substracted_img = background_elimination_substract(movie_dict["R"][10], averaged_movie_img)
background_substracted_img # Specific frame with the background elimination method applied to it(here : frame 10, red movie)

Example of an background eliminated image

background_elimination_substract_print_with_plt