🧾 TL;DR — Imaris 3D Random Spots Distance Analysis
This Imaris XT Python workflow performs a 3D null model analysis by randomly generating spots within a masked volume and calculating their shortest distances to a reference structure, based on a precomputed distance-transform channel. It runs Monte Carlo simulations at multiple seed counts (500–4000 and observed N), compares the distribution of random distances to those of observed spots, and outputs statistical summaries including empirical p-values. This analysis is aim to reproduce the method that originally published in below (Extended Data Figure 4):
Connects to an open Imaris application using ImarisLib.
Make a distance map of your target signal by using the “Distance Transformation” from Image Processing → Surfaces Functions → Distance Transformation (requires XTension); name this channel as “distance.” Optional: you can define the border by yourself on this channel.
Use the mask function to your structure surface object for masking the possible region as 1 and blocked region as 0; name this channel as “mask.”
Identifies the appropriate distance and mask channels using name hints or indices.
Randomly seeds 3D spots within the mask at different N values using Monte Carlo simulation.
Measures shortest distances from each random spot to the structure (from the distance channel).
Repeats the simulation N_ITER times to build null distributions of mean distances.
Compares observed mean distance to null distribution and computes empirical p-values.
📂 Output Files
📤 Output
📌 Content
Imaris-Spots-Ana_summary.csv
Mean distances and p-values for each N condition
*.csv (optional)
Raw distances for each spot per iteration (if enabled)