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.3.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.3-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jimg_int-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 5f1870d560992c3de80d018b12b1fe2d6a5d01ac6188260c82aeb277c1aa40a6
MD5 cc10d2b0f9217cfb2cc1d65fa0e8a25e
BLAKE2b-256 f52e63983c4396b3608b9e52cc16d5096db8614e1ac3fb59add1b2a4131a78af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jimg_int-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 35961ef0c2445f7db77bcb3a86b9fb3c1e2ebe621c6aeaec334d7ee35582f246
MD5 afa5b6507bd05a01b2e1cc856f32aaef
BLAKE2b-256 7eb03cf17763dbcad26dd67c7b5f16bff669db30f9035fb1772472db450b1f44

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