Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.8%) to scientific vocabulary
Last synced: 6 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: AlexiaTiberi
  • License: gpl-3.0
  • Language: Python
  • Default Branch: main
  • Size: 48.1 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Created about 1 year ago · Last pushed 10 months ago
Metadata Files
Readme License Zenodo

README.md

DOI

MicroNeuSeg

MicroNeuSeg is a Python-based pipeline designed to perform spatial analysis of microglia and neurons in mouse brain imaging data. The pipeline processes 3 image channels—Microglia (cx3cr1gfp or Iba1), PV, and NeuN—and outputs the spatial coordinates of detected cells, enables region-of-interest masking, and allows the analysis of their relative spatial distributions.


📋 Data Setup and Folder Structure

The pipeline expects data organized as follows:

alt text

Each subfolder represents an animal and contains TIFF images named with the following format:

<sectionnumber>_.tif

Markers should explicitly be named: Iba1, PV, or NeuN, though the code is not case sensitive.

🚀 Features

The pipeline consists of sequentially numbered scripts to be executed in order:

  1. 0segmentsingle_folder.ipynb (Optional but recommended)

    • Tests segmentation configuration on data from a single animal folder - use "animal1" folder path as defined in the Data Setup and Folder Structure chapter.
    • Useful for interactive parameter adjustments via config.py.
    • Start with this to broadly set up the segmentation
    • all my parameters for segmentation and extraction of the data have been optimized with a pixel size of circa 0.75 micron
  2. 1segmentallfolders.ipynb / 1segment_all.py

    • Performs segmentation simultaneously across all animal folders - use "data" folder path as defined in the Data Setup and Folder Structure chapter.
    • Interactive visualization recommended via notebook version (.ipynb).
    • inside each animal folder you will now find the output_csvs folder containing all coordinates of cells
  3. 2_masking.ipynb

    • Allows manual masking to define a specific region of interest (ROIs).
    • This is mandatory as this pipeline was constructed to analyze a mouse cortex, so there is a need to cut away empty parts of the images and also subcortical stuff... see the data folder for some sample images
    • inside each animal folder you will now find the masks folder containing all masks 1 per image (the three channels of course share the mask)
  4. 3filterall_folders.ipynb

    • Uses the mask drawn in 2 to filter the data coordinates from the segmentation
    • inside each animal folder you will now find the filteredcsvs folder containing all coordinates of all cells filtered to be within the mask drawn in 2.ipynb
  5. 4extractdata.ipynb

    • This is the code that does the "data analysis"
    • It will output an excel file per section analyzed of all mice
    • all my parameters for extraction of the data have been optimized with a pixel size of circa 0.75 micron
    • if the parameter visualize is set to True it will also save images to check the analysis - so segmentation results, association results and synthetic dataset creation
    • you can see the example analysis of animal1_1 in the results folder ### Parameters Extracted (per section)

Each .xlsx file generated by the analysis includes the following parameters for the masked region of each brain section:

| Parameter | Description | |----------|-------------| | Area | Area of the manually defined region of interest (ROI) in mm². | | Microglia_Density | Number of Iba1⁺ microglia per mm² within the ROI. | | PV_Density | Number of PV⁺ interneurons per mm² within the ROI. | | NeuN+PV-_Density | Density of NeuN⁺ PV⁻ cells. | | NeuN_Density | Total number of NeuN⁺ neurons per mm². | | PercMicrogliaassociatedPVObserved | Percentage of PV⁺ cells with at least one microglia within the specified threshold distance (e.g., 15 px). | | PercPVassociatedMicrogliaSynthetic | Same as above, but using a synthetic distribution of microglia to test for spatial association. | | AverageNearestDistancePVtomicrogliaObserved | Mean distance (in µm) between each PV⁺ cell and its closest microglia. | | AverageNearestDistancePVtomicrogliaSynthetic | Mean distance (in µm) for the same analysis using synthetic microglia coordinates. | | PercMicrogliaassociatedNeuNPVObserved | Percentage of NeuN⁺PV⁻ cells with at least one microglia within threshold. | | PercMicrogliaassociatedNeuNPVSynthetic | Same as above, with synthetic microglia coordinates. | | AverageNearestDistanceNeuNPVtomicrogliaObserved | Mean distance (in µm) between each NeuN⁺PV⁻ cell and its closest microglia. | | AverageNearestDistanceNeuNPVtomicrogliaSyntetic | Mean distance (in µm) for the same using bootstrapped coordinates. | | PercPVassociated_Microglia | Percentage of Iba1⁺ cells that are close (within threshold) to at least one PV⁺ cell. | | AverageNearestDistancemicrogliato_PV | Mean distance (in µm) between Iba1⁺ cells and their closest PV⁺ cell. | | PercNeuNPVassociated_Microglia | Percentage of Iba1⁺ cells close to at least one NeuN⁺PV⁻ cell. | | AverageNearestDistancemicrogliato_NeuNPV | Mean distance (in µm) between Iba1⁺ cells and their closest NeuN⁺PV⁻ cell. | | EIratio | This is a derivative parameters which is (PercNeuNPVassociatedMicroglia-PercPVassociatedMicroglia)/(PercNeuNPVassociatedMicroglia+PercPVassociatedMicroglia) |


⚙️ Installation & Requirements

My personal suggestions is to first install stardist using their installation guidelines (installation guide), which requires a working tensorflow environment

Step by step installation

Create a new conda env and activate it

conda create --name microneuseg python=3.8.20 -y conda activate microneuseg

Install Tensorflow 2.0 & stardist

conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0 pip install "tensorflow<2.11" pip install stardist

Other dependencies

conda install pandas, opencv, openpyxl

If you are using VSC (like me) install also

pip install ipykernel

📄 License

This project is licensed under the GPL-3.0 license

Owner

  • Name: Alexia Tiberi
  • Login: AlexiaTiberi
  • Kind: user

Neuroscience. Postdoc naively approaching coding. #notacoder Mostly bored with doing everything by hand. CNR, Institute of Neuroscience, Pisa, Italy

GitHub Events

Total
  • Release event: 1
  • Public event: 1
  • Push event: 7
  • Create event: 1
Last Year
  • Release event: 1
  • Public event: 1
  • Push event: 7
  • Create event: 1