Skip to main content

No project description provided

Project description

JIMG_int – Python library for marker intensity and distribution analysis

Python version License Docs

drawing drawing


Author: Jakub Kubiś

Institute of Bioorganic Chemistry
Polish Academy of Sciences

Description

JIMG_int is a Python library designed to quantify and analyze marker intensity and spatial distribution in images. It is particularly useful for biological imaging, immunofluorescence, or any field requiring analysis of labeled markers in microscopy or medical images.

The library support the JIMG image processing tool, specifically tailored for analyzing high-resolution confocal microscope images Opera-Phoenix and other technologies.

It provides algorithms for measuring the intensity of specific protein markers using customizable image masks on high-resolution microscope images. These measurements are normalized using a background mask for consistent data comparison. The collected intensity data can be statistically analyzed to detect differences in marker localization, occurrence, and intensity.



📚 Table of Contents



1. Installation

In command line write:

pip install jimg-int

2. Documenation

Documentation for classes and functions is available here 👉 Documentation 📄

3. Example pipelines

If you want to run the examples, you must download the test data. To do this, use:

from jimg_ncd.nuclei import test_data

test_data()

3.1 Marker intensity features extraction

3.1.1 Adjusting parameters and image loading
from jimg_int.intensity import FeatureIntensity

# Select intenity are data for 1st Image - healthy

# initiate class
fi = FeatureIntensity()

# check current metadata
fi.current_metadata

# if required, change parameters
fi.set_projection(projection="avg")

fi.set_correction_factorn(factor=0.2)

# fi.set_scale(scale = 0.5)
# fi.set_selection_list(rm_list = [2,5,6,7])
# OR
# load JIMG project where scale and rm_lis is set in project metadata
# fi.load_JIMG_project_(path = '')
# for more information go to: https://github.com/jkubis96/JIMG
# rm_list and scale can be omitted

# load image
fi.load_image_3D(path="test_data/intensity/ctrl/image.tiff")

# or 1D image after projection, be sure that image was not adjusted, for analysis should be use !RAW! image
# fi.load_image_(path)

Analysed image projection (after projection with JIMG)

  • input image in this case is raw 3D-image in *.tiff format

drawing


3.1.2 ROI mask loading
fi.load_mask_(path = 'test_data/intensity/ctrl/mask_1.png')

Analysed image region mask

drawing


3.1.3 Normalization mask loading
fi.load_normalization_mask_(path = 'test_data/intensity/ctrl/background_1.png')

Normalization region mask (reversed)

drawing


3.1.4 Extracting intensity values
# strat calculations
fi.run_calculations()


# get results
results = fi.get_results()
3.1.5 Saving intensity data
# save results for further analysis, ensuring each feature 
# is stored in a separate directory (single directory 
# should contain data with the same 'feature_name'),
# this setup allows running fi.concatenate_intensity_data() 
# in the specific directory of each feature
# while preventing errors from incorrect feature concatenation

fi.save_results(path = os.getcwd(), 
             mask_region = 'brain', 
             feature_name = 'Feature1', 
             individual_number = 1, 
             individual_name = 'CTRL')
3.1.6 Performing analysis pipeline for the subsequent image
  • Apply steps 3.1.1–3.1.5 to the subsequent image to support comparison analysis.
# Select intenity are data for 2st Image - disease

# initiate class
fi = FeatureIntensity()

fi.set_projection(projection="avg")

fi.set_correction_factorn(factor=0.2)

fi.load_image_3D(path="test_data/intensity/dise/image.tiff")

###############################################################################

fi.load_mask_(path="test_data/intensity/dise/mask_1.png")

###############################################################################

fi.load_normalization_mask_(path="test_data/intensity/dise/background_1.png")

###############################################################################

fi.run_calculations()

results = fi.get_results()

fi.save_results(
    path="",
    mask_region="brain",
    feature_name="Feature1",
    individual_number=1,
    individual_name="DISEASE",
)

Analysed image projection (after projection with JIMG)

  • input image in this case is raw 3D-image in *.tiff format

drawing


Normalization region mask (reversed)

drawing


Analysed image region mask

drawing

3.1.7 Combining the experimental data
# concatenate data of experiment 1 & 2
fi.concatenate_intensity_data(directory="", name="example_data")

3.2 Analyzing the intensity and spatial distribution of the marker

3.2.1 Loading experimental data

import pandas as pd
from jimg_int.intensity import IntensityAnalysis

# initiate class
ia = IntensityAnalysis()

input_data = pd.read_csv("example_data_Feature1_brain.csv")

# check columns
input_data.head()

3.2.2 Quantitative analysis of marker intensity and spatial distribution

data = ia.df_to_percentiles(
    data=input_data,
    group_col="individual_name",
    values_col="norm_intensity",
    replication_col = 'individual_number',
    sep_perc=1,
)

stats = ia.get_stats(data, tested_value = 'avg')

3.2.3 Visualizing the data using a histogram distribution

results = ia.hist_compare_plot(
    data=stats, queue=["CTRL", "DISEASE"], p_adj=True, txt_size=20
)

Results of intensity comparison analysis (region under the mask)

drawing


results.savefig('example_results.svg', format = 'svg', dpi = 300, bbox_inches = 'tight')


Have fun JBS

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jimg_int-0.1.4.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jimg_int-0.1.4-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

Details for the file jimg_int-0.1.4.tar.gz.

File metadata

  • Download URL: jimg_int-0.1.4.tar.gz
  • Upload date:
  • Size: 34.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for jimg_int-0.1.4.tar.gz
Algorithm Hash digest
SHA256 93e94e65b560f32d745894d08e7c919869b2277ff4ea8be4f9ac19d15b23b45c
MD5 aa72d39bdbef4ab5003cf1258235d511
BLAKE2b-256 dc11e585a0cceeaa9ecefcdc38e6f2d5ca23422264999e8d956a60e73cdb43f2

See more details on using hashes here.

File details

Details for the file jimg_int-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: jimg_int-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 35.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for jimg_int-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b8f01f93254f565925afe95193f7e462e6e8a11dbeff957c36ab733d61f7543e
MD5 6f2932daf7c7dc172753a2f170fcc2a3
BLAKE2b-256 4f41e9d5f973c43d5e26e04a694ff1b97a069b5887c7d5d5e07650b06afc6664

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page