Scripts for preparing data (Imaris format) for visualisation in AIDA-3D
- Clone repository:
https://github.com/3DxN/Aida3Dpreprocessing
- Create and activate a Python virtual environment (required Python version: ...):
Linux:
python -m venv venv
source venv/bin/activate
Windows:
python -m venv venv
venv/bin/Activate.ps
- Install dependencies:
pip install -r requirements.txt
Steps include:
- Converting Imaris data to TIFF
- Generating HnE
- Convert Imaris data
Imaris data is assumed to include a metadata
xmlfile describing the geometric arrangement of tiles and relative file paths to data of individual tiles. Tile image data is stored in.imsfiles referenced by the.xmlfile.
~/OMAL/250916aida3dData/012523_303_1_63X_stitchable.xml
python genHnE.py data/012523_303_1_63X_stitchable.xml --TIFFwriteout ./data/TIFFtiles 1 --nuclearChannel 3 --cytoChannel 4 --fixedZposition 11
- Run segmentation
python src/segmentation/predCellpose3D.py --inDir data/TIFFtiles/ --outDir data/CellposeSegementations --tileJsonFilename data/features/tileArrangement.json
- Run CD8/GH2AX analysis
python src/proximityAnalysis/analyze_multi.py
Note: Set parameters in file src/proximityAnalysis/config.py (to be replaced by argparse interface)
- Plot results
python src/proximityAnalysis/plotRatios.py
usage: PlotRatios [-h] [-p PLOT_OUTPUT_FORMAT] [-c [CLASSLIST ...]] [--num_pseudo_classes NUM_PSEUDO_CLASSES]
pct_cd8_json_file pct_gh2ax_json_file mean_intensity_gh2ax_json_file
PlotRatios: error: the following arguments are required: pct_cd8_json_file, pct_gh2ax_json_file, mean_intensity_gh2ax_json_file
e.g.,
python src/proximityAnalysis/plotRatios.py pct_cd8_2026_02_19-11_24_40.json pct_gh2ax_2026_02_19-10_55_23.json mean_intensity_gh2ax_2026_02_19-11_24_40.json -c control control -p pdf
Use the Snakemake pipeline to run the full workflow from a single config file.
- Install Snakemake (in the same environment as the repo dependencies):
pip install snakemake
- Edit
config.yaml. - Run individual steps or the full pipeline:
snakemake -j 1 hne
snakemake -j 1 segmentation
snakemake -j 1 analysis
snakemake -j 1 plot
snakemake -j 1 labels2starconvex3d
snakemake -j 1 extract_vis_data
snakemake -j 1
To override input/output roots from the CLI:
snakemake -j 1 --config input_dir=/path/to/inputs output_dir=/path/to/outputs
Notes:
- The analysis step writes a JSON config for
src/proximityAnalysis/config.pyunderdata/workflow_state. - The plot step selects the most recent analysis outputs and creates
*_texture_features_w_neighbors.csvaliases to matchplotRatios.pyexpectations. - Geometry steps are controlled via the
geometrysection inconfig.yaml. Setgeometry.enabled: trueto include them in the defaultsnakemake -j 1run. labels2starconvex3dexpects Cellpose.npyoutputs (masks/flows). If you already have StarDist*.pickleoutputs, setgeometry.run_labels2starconvex: falseand pointgeometry.input_dirto those pickles.- Input paths (e.g.,
imaris_xml,raw_image_path,xml_files_path) resolve relative toinput_dirwhen not absolute. - Output paths (e.g., TIFFs, segmentations, analysis outputs) resolve relative to
output_dirwhen not absolute. - Use
snakemake -n -pfor a dry run with command printing.