Skip to content

csitron/Microscopy_lif_Channel_Masked_Intensity_Quant_MATLAB

Repository files navigation

Quantification of masked fluorescence intensity and nuclear count from .lif files in MATLAB
Project description:
This package contains a series of functions designed to analyze .lif image files acquired from Leica 
microscopes. The workflow enables the generation of maximum intensity projections, the 
quantification of fluorescence signal within a masked area, and the counting of nuclei from a DAPI 
(or equivalent) channel. These tools are intended for use in fluorescence microscopy quantification 
tasks such as nuclear segmentation and mean signal intensity measurement within a mask.

How to install the project:
Aside from standard MATLAB functions, this package depends on the bfopen function, developed 
by OpenMicroscopy, which is available at: 
https://docs.openmicroscopy.org/bio-formats/5.8.2/users/matlab/index.html 
Make sure that bfopen and the Bio-Formats toolbox are in your MATLAB path. The code has been 
tested on Windows 10. No special hardware is required. If MATLAB is already installed, setup 
should take less than 5 minutes. The functions have been tested in MATLAB R2020b.

Running the code:
This workflow involves three functions that should be run in the following order:

1. lif_build_max_projections
This function generates max-intensity projections from a .lif file and pseudocolors selected 
channels.
Inputs:
*	lif_file — path to your .lif file
*	colors — cell array of strings specifying pseudocolors for each channel (e.g. 
{'magenta','cyan','yellow'}); should match the order of the channels in the .lif file. Options 
are ‘magenta’, ’cyan’, ’blue’, ’white’, and ‘yellow’.
*	bitdepth — typically 256 for 8-bit images, or 65535 for 16-bit images
*	gaussfilt — 1 to apply a Gaussian filter, 0 otherwise
*	channels_of_interest (optional) — indices of channels to include in projections
Outputs:
*	names — sample names extracted from .lif metadata
*	store_images_pseudo — cell array of pseudocolored max projections (for visualization)
*	store_images_maxonly — grayscale max projections for each individual channel (used in 
downstream steps)

2. count_nuclei
Counts the number of nuclei per sample using adaptive thresholding and morphological cleanup 
on the DAPI (or equivalent) channel.
Inputs:
*	names — from lif_build_max_projections
*	store_images_maxonly — from lif_build_max_projections
*	dapi_channel — index of the DAPI channel in your image
*	gaussfilt — standard deviation for Gaussian smoothing (e.g. 1 or 2)
*	threshold_adapt — sensitivity value for adaptive thresholding (suggested: 0.3–0.5)
*	pixel_size_cutoff — minimum size (in pixels) to consider as a nucleus
Output:
*	nuclei_counts — number of nuclei per image

3. quantify_masked_intensity
Quantifies the mean fluorescence intensity in a given signal channel, masked by another channel 
(e.g., a nuclear or cytoplasmic marker).
Inputs:
*	names — from lif_build_max_projections
*	store_images_maxonly — from lif_build_max_projections
*	mask_channel — index of the channel used to generate the binary mask
*	signal_channel — index of the fluorescence signal to quantify
*	mask_size — minimum mask object size in pixels (used to exclude noise)
Output:
*	store_results — matrix with 3 columns:
1.	mean masked intensity
2.	total masked intensity
3.	number of masked pixels

Example usage:
Please see image_quant_driver.m for an example of how to run the code.

Acknowledgments:
We acknowledge OpenMicroscopy for the bfopen function provided as part of the Bio-Formats 
project. This work was supported by the joint efforts of The Michael J. Fox Foundation for 
Parkinson’s Research (MJFF) and the Aligning Science Across Parkinson’s (ASAP) initiative. MJFF 
administers the grants ASAP-000282 and ASAP-024268 on behalf of ASAP and itself.

About

Quantification of masked fluorescence intensity and nuclear count from .lif files in MATLAB

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages