Created: 16 September, 2025 Last updated: 24 September, 2025
This github repo contains the ImageJ and R scripts used for the integration of publicly available Visium-SPG data and morphology analysis presented in Kim et al., 2025:
insert citation
Below are the steps that were taken for this analysis, and links & locations of where you can find related scripts (Github) and datasets (OSF):
Download publicly available datasets from Huuki Myers 2024
- spe object – Github
- Visium-SPG .tiff files
- Visium-SPG spot coordinates
- Visium spot deconvolution data → tidied and saved as .rds object: – OSF: rds_files/SpotDeconvolution_A1-C1.rds
Prepare images for MicrogliaMorphology
- use ImageJ to manually subtract lipofuscin.tiff from tmem119.tiff – OSF: MicrogliaMorphology_InputImages_LipofuscinSubtracted
- open paired lipofuscin and tmem119 channel images
- Process > Image Calculator: lipofuscin.tiff - dapi.tiff
Run MicrogliaMorphology and MicrogliaMorphologyR
- run updated thresholding macro – Github
- run rest of MicrogliaMorphology steps
- explore data using MicrogliaMorphologyR – Github
Save morphology data
- save dataframe of microglia and morphology features – Github, OSF: rds_files/MicrogliaMorphology_FinalData.rds
- save .csv files of CellIDs for each image
Save ROI .zip files of microglia ROIs and Visium Spot ROIs using following ImageJ macros
Generate microglia information sheet, which includes new ImageJ measures: proportion_cellarea, proportion_spotarea
- AreaOverlap.ijm: ImageJ macro to calculate area overlap between visium spots and microglia cells - Github
- manually calculate cell areas using microglia masks
- open lipofuscin-subtracted .tiff image - OSF: MicrogliaMorphology_InputImages_LipofuscinSubtracted
- drag and drop image-specific microglia ROI .zip file - OSF: ImageJ_ROI_ZipFiles/A1-C1_AllMicroglia_PreFiltering_ROIs.zip
- select all in ROI manager and click Measure button
- make sure Analyze > Set Measurements has ‘Area’ and ‘Display Label’ selected
- save cell area measurement output for each image separately
- read in AreaOverlap.ijm output, cell areas, and calculate proportion_cellarea and proportion_spotarea measures - Github
- save to Microglia-spot-info dataframe to be read in later for integration with Visium-SPG object – OSF: rds_files/Microglia-spot-info_LipofuscinSubtracted.rds
Analysis of antibody fluorescent channel signals at Visium capture area level (Fig. S1A)
- manually calculate mean signal intensity histogram for each antibody for each image
- open lipofuscin-subtracted .tiff image - OSF: MicrogliaMorphology_InputImages_LipofuscinSubtracted
- drag and drop image-specific Visium capture area ROI file - OSF: ImageJ_ROI_ZipFiles/A1-D1_VisiumCaptureAreas.zip
- select ROI in ROI manager
- select Analyze > Histogram, then click List button to obtain histogram data
- save histogram data output for each image individually
- files joined and saved as VisiumCaptureAreas_MeanGrayValues_AllChannels.rds – Github, OSF: rds_files/VisiumCaptureAreas_MeanGrayValues_AllChannels.rds
- signal intensity histograms plotted for capture area-specific antibody signals – Github
Analysis of antibody fluorescent channel signals at Visium Spot level (Fig. S1B-D)
- manually calculate mean signal intensity and area for each antibody for each image
- open lipofuscin-subtracted .tiff image - OSF: MicrogliaMorphology_InputImages_LipofuscinSubtracted
- drag and drop image-specific Visium spot ROIs - OSF: ImageJ_ROI_ZipFiles/A1-D1_VisiumSpot_ROIs
- select all in ROI manager and click Measure button
- make sure Analyze > Set Measurements has ‘Area fraction’, ‘Mean gray value’, and ‘Display Label’ selected
- save mean signal intensity and area measurements as separate file for each image
- files read in and saved as MeanGrayValue_AllChannels.rds – Github, OSF: rds_files/MeanGrayValues_AllChannels.rds
- signal intensity and percentage area histograms plotted for spot-level antibody signals – Github
- pearson’s correlations calculated across mean signal intensity or signal area with cell type proportions/numbers in spe object – Github
Identify multi-cell spots (excluded 8 ‘problem’ masked spots)
- R code to identify any spots with multiple morphology classes that were masked/hidden in filtering process (Fig. 2A; Fig. S3) - Github, OSF: rds_files/MulticlassSpotIDs.csv, AllMGdata_preANYfiltering.csv, MultiClassSpots_ExcludeAtEnd.csv, PseudobulkedSpots.csv